Reputation: 698
I have set up a splash screen to be used by my application in the manifest. If I create my jar using eclipse, the splash screen is displayed when I double click the jar. However, when I try to launch my application from the command line using java -classpath blah.jar, I get no splashscreen. I have also tried specifying java -splash:Resources/blah.png [...], but this doesn't work either (Resources/blah.png is my path within my jar).
I need to have it work through the command line for two reasons. First, some of the client machines may not have their system configured correctly to run the jar directly by double clicking. Second, through the command line I want to set my heap size and perm space size since in some cases it may be needed (it would be great to be able to do this through my manifest).
Lastly, I'd rather not have an images directory floating around separate to my jar.
In short, how do I use a java splash screen specified in the manifest when the jar is launched from the command line? Second, is there a good way to set my heap and permspace sizes without launching through the command line?
Upvotes: 1
Views: 1441
Reputation: 691865
Launch the app with the -jar
option instead of the -cp
option. This tells java to load the classpath, the main class and other options like the splash screen from the jar's manifest:
java -jar myJar.jar
That's the command that the system uses when double-clicking on a jar (except it uses javaw
and not java
).
If you want to have a double-clickable file which sets the heap and permgen size, then create a .bat
/.sh
file, or use a tool like launch4j.
Upvotes: 5