我正在使用其他答案所建议的 jarbundler 2.2.0,因为该应用程序应该在 Apple 的 JRE 1.6 上运行。
捆绑包似乎是正确的,显示有适当的图标,但单击它没有任何作用。如果我进入它的内容并尝试双击带有指定主文件的 jar 工作正常。
有没有办法看看发生了什么?我可以看到某种错误或日志?
编辑 请求的 Info.plist。由于代码是私有的,我用应用程序替换了一些东西:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Application</string>
<key>CFBundleShortVersionString</key>
<string>2.2.0</string>
<key>CFBundleGetInfoString</key>
<string>Application version</string>
<key>CFBundleAllowMixedLocalizations</key>
<string>false</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleExecutable</key>
<string>JavaApplicationStub</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>beta</string>
<key>CFBundleIconFile</key>
<string>SynamicD.icns</string>
<key>CFBundleIdentifier</key>
<string>net.sourceforge.javydreamercsw</string>
<key>Java</key>
<dict>
<key>MainClass</key>
<string>net.sourceforge.javydreamercsw.Main</string>
<key>JVMVersion</key>
<string>1.6.*</string>
<key>ClassPath</key>
<array>
<string>$JAVAROOT/Application.jar</string>
<string>$JAVAROOT/lib\lib1.jar</string>
<string>$JAVAROOT/lib\lib2.jar</string>
</array>
<key>Properties</key>
<dict>
<key>apple.awt.textantialiasing</key>
<string>true</string>
<key>apple.awt.brushMetal</key>
<string>true</string>
<key>apple.laf.useScreenMenuBar</key>
<string>true</string>
<key>apple.awt.showGrowBox</key>
<string>true</string>
</dict>
</dict>
</dict>
</plist>
PkgInfo 的内容:
APPL????
在 Application.app/Contents/MacOS 我有来自 Mac 机器的 JavaApplicationStub。
结果文件结构:
Application.app
|
---Contents
|
---Info.plist
---PkgInfo
---MacOS
|
| ---JavaApplicationStub
---Resources
|
---Java
|
----lib
|
---lib1.jar
|
---lib2.jar
|
---Application.jar
|
---Application.icns
请求的命令输出:
~ $ java -version
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
~ $ sw_vers -productVersion
10.8.2
~ $ /usr/libexec/java_home -V
Matching Java Virtual Machines (4):
1.7.0_17, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home
1.7.0_15, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home
1.6.0_43-b01-447, x86_64: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
1.6.0_43-b01-447, i386: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home
~ $ /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home
~ $ echo $JAVA_HOME
~ $ echo $JAVA_ARCH
~ $ /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
~ $ ls /Library/Java/JavaVirtualMachines
jdk1.7.0_15.jdk jdk1.7.0_17.jdk
~ $ /System/Library/Frameworks/JavaVM.framework/Commands/java -version
java version "1.6.0_43"
Java(TM) SE Runtime Environment (build 1.6.0_43-b01-447-11M4203)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01-447, mixed mode)
~ $