开发者

Java 6 Splash Screen

I've never been able to get the Java 6 splash screen to work.

I've tried everything I can think of. My manifest.mf 开发者_运维技巧contains:

Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
SplashScreen-Image: geotagsplashscreen.gif

I put file "geotragsplashscreen.gif" in the root of my source tree, and verify that it makes it into the root of the resulting .jar file. I've also tried it in various places, again confirming its position in the jar, and put the path in SplashScreen-Image.

It never shows up.

Attempts to get the splash screen at runtime fail:

    final SplashScreen splash = SplashScreen.getSplashScreen();
    if (splash == null) {
        return;
    }

splash is always null for me.

Any ideas on what I'm missing here?


The steps here work

  • http://java.sun.com/docs/books/tutorial/uiswing/misc/splashscreen.html

Couple of notes:

  1. Place the splash screen image in your JAR file
    • for example: images/splash.gif
  2. Do not use a leading slash when referencing the file in manifest
    • for example: SplashScreen-Image: images/splash.gif


Using the jvm argument -splash I had the same problem when I put the splash image inside a jar. Worked fine when I left it reside unpacked next to the start script.


If you're running via Java command-line, you must use "java -jar ". You will not see the splash screen if you run Java with just a classpath option: e.g., "java -cp ...".


It is really easy to use, I always followed sun tutorial with sucess:

http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/splashscreen/ http://java.sun.com/docs/books/tutorial/uiswing/misc/splashscreen.html


I've had the same problem. Steps that solved it:

  1. Add the line "SplashScreen-Image: view/geotagsplashscreen.gif" into the manifest.ms file

  2. Right click on your project, go to Properties -> Run -> VM Options -> add the line "-splash:src/view/geotagsplashscreen.gif"

  3. Right click on your project, go to Properties -> Application -> Splash Screen -> Browse (browse to the location of your splash screen file and add it).

Worked for me, hope it solves your problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜