使用Jar内部文件的Java Splash Argument

时间:2022-05-18 17:20:13

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

所以我在一个包里面有一个Splash.png文件。我想在运行jar文件时传递-splash:splash.png参数但是我希望将路径定向到jar中的内部包而不是外部jar实际运行的地方

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

例如,我有一个名为res的软件包但是当我执行-splash:res / splash.png时它不会显示启动

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

当我做-splash:splash.png并将png文件放在jar文件外面时它会显示启动画面没问题。

2 个解决方案

#1


2  

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

在jar中,似乎必须通过runnable jar中的manifest来指定它。

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

请参阅http://docs.oracle.com/javase/tutorial/uiswing/misc/splashscreen.html上的“如何使用JAR文件显示启动画面”部分

#2


0  

/META-INF/MANIFEST.MF

/META-INF/MANIFEST.MF

JAR: image in a package?

JAR:包装中的图像?

  • package theshow.jimmylandstudios.gui
  • 打包theshow.jimmylandstudios.gui
  • img-path 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
    

#1


2  

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

在jar中,似乎必须通过runnable jar中的manifest来指定它。

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

请参阅http://docs.oracle.com/javase/tutorial/uiswing/misc/splashscreen.html上的“如何使用JAR文件显示启动画面”部分

#2


0  

/META-INF/MANIFEST.MF

/META-INF/MANIFEST.MF

JAR: image in a package?

JAR:包装中的图像?

  • package theshow.jimmylandstudios.gui
  • 打包theshow.jimmylandstudios.gui
  • img-path 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