我有一个由ANT脚本生成的JAR文件,其中包含以下代码:
<manifest>
<attribute name="Main-Class" value="org.epistasis.exstracs.Main"/>
<attribute name="Class-Path" value="."/>
<attribute name="SplashScreen-Image" value="logo_anim.gif"/>
</manifest>
<!--Some code-->
<zipfileset dir="." includes="logo.png"/>
<zipfileset dir="." includes="logo_anim.gif"/>
<zipfileset dir="." includes="icon.png"/>
当我运行JAR文件时,不会生成启动画面 . 我通过我最喜欢的归档管理器打开它来验证GIF是否在文件中 . 我还从代码中加载了GIF并成功显示了它 . 但是,它不会作为启动画面加载 . (没有显示闪屏, SplashScreen.getSplashScreen()
返回 null
)
如果我更换
<attribute name="SplashScreen-Image" value="logo_anim.gif"/>
同
<attribute name="SplashScreen-Image" value="logo.png"/>
要么
<attribute name="SplashScreen-Image" value="icon.png"/>
将使用指定的图像显示启动画面 .
我不确定这是否重要,但GIF明显大于PNG文件 . ( logo_anim.gif
约为2MB, logo.png
为40KB)