Mac 操作系统、Java 启动画面
我正在尝试将我的 Java 应用程序迁移到 Mac OS。
当应用程序启动时,应该出现启动画面。
当我从终端运行应用程序时,它会像这样:
<代码> java -classpath /the/right/classpath/ -splash:images/splash.png myApp/Main
当我这样做时,会出现启动画面。
但是当我将应用程序与 Jar Bundler,启动屏幕没有出现。
在 Jar Bundler 的属性选项卡下,在 VM 选项中我写道:splash:images/splash.png
我也尝试过:-splash:images/splash.png
(带连字符)。
我还标记了选项“将工作目录设置到应用程序包内部”。
我将 images/splash.png
复制到:
这很奇怪,因为 myApp.app 成功运行 - 它只是不显示启动屏幕。
我在控制台发现这两条消息:
2 月 11 日 02:53:32 SnowL /Users/myusername/Desktop/myApp.app/Contents/MacOS/JavaApplicationStub[24262]:忽略无法识别的 Java VM 选项:-splash:images/splash.png
This without hyphen before the splash attribute.
Feb 11 02:55:50 SnowL /Users/myusername/Desktop/myApp.app/Contents/MacOS/JavaApplicationStub[26314]:忽略无法识别的 Java VM 选项:splash:images/splash.png
当我运行应用程序从终端出现启动画面, 但双击应用程序不显示启动画面?
它应该像终端虚拟机一样运行在同一个虚拟机上,不是吗?
我还将 JVM 版本(在 Info.plist 文件上)更改为:
1.5*
1.5+
1.6*
1.6+
它们都没有使启动屏幕出现。
感谢您的帮助!
I'm trying to immigrate my Java application to Mac OS.
When the application start, splash screen supposed to appear.
When i running the App from the terminal it go like this:
java -classpath /the/right/classpath/ -splash:images/splash.png myApp/Main
when i do like this the splash screen appears.
But when i bundle the App with the
Jar Bundler, the splash screen does not appear.
on the Jar Bundler, under the properties tab, in the VM Option i wrote:splash:images/splash.png
I also tried:-splash:images/splash.png
(with hyphen).
I marked the option "Set Working Directory To Inside Application Package" as well.
i copy the images/splash.png
to :
But the splash screen refuses to appear!
It's strange because the myApp.app succeed to run - it just not show the splash screen.
I found at the console this two messages:
Feb 11 02:53:32 SnowL /Users/myusername/Desktop/myApp.app/Contents/MacOS/JavaApplicationStub[24262]: Unrecognized Java VM option ignored: -splash:images/splash.png
This without hyphen before the splash attribute.
Feb 11 02:55:50 SnowL /Users/myusername/Desktop/myApp.app/Contents/MacOS/JavaApplicationStub[26314]: Unrecognized Java VM option ignored: splash:images/splash.png
How it can by that when i run the app from the terminal the splash screen appear,
but double click on the App does not show the splash screen?
it supposed to run on the same VM like the terminal VM, doesn't it?
I olso change the JVM version (on the Info.plist file) to:
1.5*
1.5+
1.6*
1.6+
none of them make the splash screen to appear.
Thanks for help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
像这样,在你的 Info.plist 中:
Like this, in your Info.plist:
在我的应用程序中:
Info.plist:
将 splash.png 复制到 myapp.app/Contents/Resources/Java/splash.png
等等瞧。
In my application:
Info.plist:
Copy splash.png to myapp.app/Contents/Resources/Java/splash.png
et voila.
您可以让您的应用程序在应用程序启动时显示一个带有装饰的 jFrame 和您的图片
You could make your application show a jFrame with decorations off and your picture at the start up of the application
我遇到了同样的问题,并在此线程上找到了解决方案:
http ://lists.apple.com/archives/java-dev/2008/Jun/msg00012.html
它涉及在使用 Jar Bundler 后向捆绑应用程序的 Info.plist 文件添加一个条目。此外,还需要将图像复制到 myApp.app/Contents/Resources/Java(至少使用“在应用程序包内设置工作目录”选项)。可能有更好的方法,但这似乎有效。
I had the same problem, and found a solution on this thread:
http://lists.apple.com/archives/java-dev/2008/Jun/msg00012.html
It involves adding an entry to the bundled application's Info.plist file after using Jar Bundler. Also, the image needs to be copied to myApp.app/Contents/Resources/Java (at least with the "set working directory inside application package" option). There's probably a better way, but this seems to work.