CeciliA CeciliA - 1 year ago 105
Java Question

How to add Splash Screen on a Project that runs normally if you make it a JAR file

My problem guys is if im adding splash screen on netbeans. There`s an error if you build the project to make it a JAR file. Is there a way for me to add a Splash Screen that works in a JAR file? Thanks in Advance guys.

Here is my Property Panel

enter image description here

Answer Source

You need to add it to the manifest.mf file above the line:

 X-COMMENT: Main-Class will be added automatically by build

Then leave it up for a while in main method if you want:

 SplashScreen splash = SplashScreen.getSplashScreen();
 if(splash != null)
        Thread.sleep(2000); //Leave Splash up for 2 seconds
    catch(InterruptedException e) { LOG.log(Level.INFO, "Spash Sleep Interrupted", e); }
    LOG.info("Splash Screen is null");

Or do something in another thread while main sleeps

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download