Draque Thompson
Draque Thompson

Reputation: 948

Java 9+ Equivalent to Manifest Defined Splash Screen

I recently upgraded my application from Java 8 up to Java 12. I used to distribute as a runnable jar file, but am now distributing a runnable image. In the past, I defined a splash screen in the manifest which would display while the app loads (and well before a single line of my code ran). Is there any equivalent functionality I can use now that I have switched from running from a jar file to running from an image?

Upvotes: 1

Views: 262

Answers (1)

user85421
user85421

Reputation: 29680

Check the documentation of java.awt.SplashScreen:

If the Java implementation provides the command-line interface and you run your application by using the command line or a shortcut, use the Java application launcher option to show a splash screen. The Oracle reference implementation allows you to specify the splash screen image location with the -splash: option.

For example:

java -splash:filename.gif Test

or of the java command:

-splash:imagepath

Shows the splash screen with the image specified by imagepath. HiDPI scaled images are automatically supported and used if available. The unscaled image file name, such as image.ext, should always be passed as the argument to the -splash option. The most appropriate scaled image provided is picked up automatically.

For example, to show the splash.gif file from the images directory when starting your application, use the following option:

-splash:images/splash.gif

Upvotes: 1

Related Questions