Mac 操作系统、Java 启动画面

发布于 2024-10-17 09:49:33 字数 1463 浏览 3 评论 0原文

我正在尝试将我的 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/Contents
  • myApp.app/Contents/Resources
  • myApp.app/Contents/Resources/Java
  • myApp.app/Contents/MacOS
  • But the splash screen refuses to appear!

    这很奇怪,因为 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 :

  • myApp.app/Contents
  • myApp.app/Contents/Resources
  • myApp.app/Contents/Resources/Java
  • myApp.app/Contents/MacOS
  • 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 技术交流群。

    扫码二维码加入Web技术交流群

    发布评论

    需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

    评论(4

    多彩岁月 2024-10-24 09:49:34

    像这样,在你的 Info.plist 中:

    ...
    <key>Java</key>
        <dict>
    
        <key>MainClass</key>
        <string>...</string>
    
        <key>SplashFile</key>
        <string>$APP_PACKAGE/tmp_splash.png</string>
    ...
    

    Like this, in your Info.plist:

    ...
    <key>Java</key>
        <dict>
    
        <key>MainClass</key>
        <string>...</string>
    
        <key>SplashFile</key>
        <string>$APP_PACKAGE/tmp_splash.png</string>
    ...
    
    浅紫色的梦幻 2024-10-24 09:49:34

    在我的应用程序中:
    Info.plist:

        ...
        <dict>
            <key>ClassPath</key>
            <string>$JAVAROOT/@[email protected]:@CLASSPATH@</string>
            <key>JVMVersion</key>
            <string>1.6+</string>
            <key>MainClass</key>
            <string>@PROJECTMAINCLASS@</string>
            <key>SplashFile</key>
            <string>$JAVAROOT/splash.png</string>
        ...  
    

    splash.png 复制到 myapp.app/Contents/Resources/Java/splash.png
    等等瞧。

    In my application:
    Info.plist:

        ...
        <dict>
            <key>ClassPath</key>
            <string>$JAVAROOT/@[email protected]:@CLASSPATH@</string>
            <key>JVMVersion</key>
            <string>1.6+</string>
            <key>MainClass</key>
            <string>@PROJECTMAINCLASS@</string>
            <key>SplashFile</key>
            <string>$JAVAROOT/splash.png</string>
        ...  
    

    Copy splash.png to myapp.app/Contents/Resources/Java/splash.png
    et voila.

    递刀给你 2024-10-24 09:49:34

    您可以让您的应用程序在应用程序启动时显示一个带有装饰的 jFrame 和您的图片

    You could make your application show a jFrame with decorations off and your picture at the start up of the application

    深府石板幽径 2024-10-24 09:49:34

    我遇到了同样的问题,并在此线程上找到了解决方案:

    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.

    ~没有更多了~
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文