简体   繁体   中英

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.

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

/META-INF/MANIFEST.MF

JAR: image in a package?

  • package theshow.jimmylandstudios.gui
  • img-path theshow/jimmylandstudios/gui

     Manifest-Version: 1.0 Class-Path: . Main-Class: theshow.jimmylandstudios.gui.GUI SplashScreen-Image: theshow/jimmylandstudios/gui/images/splash.png 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM