Search code examples
javasplash-screenjvm-arguments

Java Splash Argument using file inside Jar


So I have a Splash.png file inside a package. I want to pass the -splash:splash.png argument when running the jar file but I want the path to be directed to an internal package in the jar not externally where the jar is actually running

for example I have a package called res but when I do -splash:res/splash.png it wont show the splash

when I do -splash:splash.png and have the png file laying outside the jar file it shows the splash screen no problem.


Solution

  • When inside the jar it appears that it must be specified through the manifest in the runnable jar.

    Manifest-Version: 1.0
    Main-Class: <class name>
    SplashScreen-Image: <image name>
    

    See "How to Use a JAR File to Display Splash Screen" section of http://docs.oracle.com/javase/tutorial/uiswing/misc/splashscreen.html