启动画面不出现 [英] Splash screen does not appear

查看:47
本文介绍了启动画面不出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了清单文件来显示它.

I wrote the manifest file to show it.

Manifest-Version: 1.0
Main-Class: app.App
SplashScreen-Image: images/splash.png

当我编写下面的代码并运行 jar 文件时,

and when I wrote the below code and ran the jar file,

final SplashScreen splash = SplashScreen.getSplashScreen();

if (splash == null) {
    System.out.println("null");
    return;
}

Graphics2D g = splash.createGraphics();

if (g == null) {
    System.out.println("null");
    return;
}

我总是收到null"消息.我错过了什么?

I always get "null" message. What am I missing?

推荐答案

检查生成的 jar 中的 MANIFEST.MF 文件是否包含 SplashScreen-Image 条目,如果没有尝试更正项目中现有的清单文件,不要忘记添加行尾.

Check if MANIFEST.MF file inside generated jar contains SplashScreen-Image entry, if not try to correct your existing manifest file inside your project and don't forget to add end of line to it.

来自 Oracle 修改清单文件:警告:用于创建清单的文本文件必须以换行符或回车符结尾.如果最后一行没有以换行符或回车符结束,将不会被正确解析.

这篇关于启动画面不出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆