因此,我尝试将我的.jar捆绑到可执行文件中的this tutorial之后的可执行文件中。 .jar可以双击,并且功能完善。但是,我的.app捆绑包的图标上有一个划线标记,双击时不会打开。我还尝试双击JavaApplicationStub
可执行文件,但这会打开一个终端,输出:
Last login: Wed Feb 20 13:22:32 on ttys001
Michaels-MacBook-Pro-3:~ student$ /Users/student/Desktop/Humansight\ Survey.app/Contents/MacOS/JavaApplicationStub ; exit;
2019-02-20 13:29:30.995 JavaApplicationStub[11479:292031] There was an error parsing the Info.plist for the bundle at URL <0x7f9e52000000>: NSCocoaErrorDomain - 3840
[JavaAppLauncher Error] CFBundleCopyResourceURL() failed loading MRJApp.properties file
[JavaAppLauncher Error] CFBundleCopyResourceURL() failed while getting Resource/Java directory
[LaunchRunner Error] No main class specified
[JavaAppLauncher Error] CallStaticVoidMethod() threw an exception
Exception in thread "main" java.lang.NullPointerException
2019-02-20 13:29:32.074 JavaApplicationStub[11479:292031] There was an error parsing the Info.plist for the bundle at URL <0x7f9e50627680>: NSCocoaErrorDomain - 3840
at apple.launcher.LaunchRunner.run(LaunchRunner.java:113)
at apple.launcher.LaunchRunner.callMain(LaunchRunner.java:51)
at apple.launcher.JavaApplicationLauncher.main(JavaApplicationLauncher.java:61)
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]
这是我第一次尝试捆绑.jar,并且仅供个人使用,因此我不需要它包含应用商店的任何标准。我只想双击一个带有图标的可执行文件。这是我的info.plist,我只是从另一个应用程序复制并更改以供自己使用。
<?xml version="1.0" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>JavaApplicationStub</string>
<key>CFBundleIconFile</key>
<string>humansightIcon.icns</string>
<key>CFBundleIdentifier</key>
<string>HumansightSurvey</string>
<key>CFBundleDisplayName</key>
<string>Humansight</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Humansight</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>JVMMainClassName</key>
<string>Main</string>
<key>JVMOptions</key>
<key>JVMArguments</key>
<array>
</array>
</dict>
</plist>