有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java信息。普利斯特。如何指定多个可执行文件?

我想出了一些写信息的基本方法。用于打包mac应用程序的plist文件。我遇到了一个有点恼人的问题。我有一个jar文件,它是应用程序的主要入口点。plist文件有一个启动程序集,因为它是CbundleExecutable的。这个启动器打开jar文件

有2个jar文件。jar1由启动器调用,检查并执行更新。完成后,jar1执行jar2。一旦jar2执行,plist文件提供的信息似乎就消失了。CFBundleIcon和CFBundleDisplayName返回默认java

我猜这是因为启动程序脚本不再运行,并且所有plist设置都设置为该启动程序。我怎样才能尽可能无痛地解决这个问题?我能再加一个吗。Jar2的应用程序。应用程序?有消息吗。plist解决方案?它没有破坏任何功能,只是看起来不专业

包装内容如下: 应用程序->;内容->;MacOs->;[jar1、jar2、启动器、sharedAccessFiles]

我使用以下命令从jar 1调用jar 2:

ProcessBuilder pb = new ProcessBuilder(pathToJava "-jar", pathToJar2, "-Xdock:icon=" + pathToIcon, "-Xdock:name=AppName");

这似乎没有改变什么。顶部栏仍然显示java,图标保持不变


共 (1) 个答案

  1. # 1 楼答案

    启动JAR#2时,请使用以下参数:

    -Xdock:icon=pathToIconFile Sets the icon displayed in the Dock. By default, OS X displays a generic Java icon unless you specify otherwise. You only need to use this for applications launched from the command line or from a JAR file. Double-clickable application bundles designate their icon in the Info.plist file.

    -Xdock:name=applicationName Sets the name to display in the Dock and in the menu bar. By default, OS X displays the fully qualified name of the main class unless you specify otherwise. You need to use this only for applications launched from the command line or from a JAR file. Double-clickable application bundles get the appropriate name from the Info.plist file.

    https://developer.apple.com/library/mac/documentation/Java/Reference/Java_VMOptionsRef/Articles/JavaVirtualMachineOptions.html