【问题标题】:Java Manually Package .JAR into .APPJava 手动将 .JAR 打包成 .APP
【发布时间】:2013-12-28 03:00:43
【问题描述】:

我在 OS X 上用 Java 编写了我的程序,我想将我的 .JAR 捆绑到一个可运行的 .APP 中,以便分发我的程序。我正在运行 OS X 10.9,但在我的机器上找不到 Apple 的 JarBundler.app。我查看了 Oracles Jar Bundler 解决方案,它需要一个 .plist。所以我的问题是,如何创建我需要的 plist,我可以手动构建我的 .app 吗?

解决方案:

经过足够的调整,我终于能够让我的 java 应用程序捆绑并作为 .app 运行。

   <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"     "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrefPaneIconFile</key>
<string>NotesClonerIcon.icns</string>
<key>Java</key>
<dict>
    <key>JVMVersion</key>
    <string>1.6+</string>
    <key>MainClass</key>
    <string>Notes_Cloner</string>
    <key>ClassPath</key>
    <string>$JAVAROOT/NotesCloner.jar</string>
    <key>Properties</key>
    <dict>
        <key>java.library.path</key>
        <string>$JAVAROOT/</string>
    </dict>
</dict>
<key>Properties</key>
<dict>
    <key>apple.laf.useScreenMenuBar</key>
    <string>true</string>
</dict>
<key>CFBundleExecutable</key>
<string>JavaApplicationStub</string>

    <key>CFBundleIconFile</key>
<string>NotesClonerIcon.icns</string>

<key>WorkingDirectory</key>
<string>$APP_PACKAGE/Contents/Resources/</string>

<key>CFBundleName</key>
<string>Notes Cloner Mac</string>

<key>CFBundleDisplayName</key>
<string>Notes Cloner Mac</string>

<key>NSPrefPaneIconLabel</key>
<string>Notes Cloner Preferences</string>

<key>CFBundleGetInfoString</key>
<string>Written By:Larry Wells </string>

<key>NSHumanReadableCopyright</key>
<string>Copyright © 2013, Larry Wells,All Rights Reserved.</string>

<key>CFBundleIdentifier</key>
<string>com.LarryWells.NotesClonerMac</string>

<key>CFBundleInfoDictionaryVersion</key>
<string>1.0</string>

<key>CFBundlePackageType</key>
<string>APPL</string>

<key>CFBundleShortVersionString</key>
<string>1.0.0</string>

<key>CFBundleSignature</key>
<string>????</string>

<key>CFBundleVersion</key>
<string>1.0.0</string>
</dict>
</plist>

【问题讨论】:

  • 这可能会有所帮助:stackoverflow.com/questions/14917908/…
  • 您打算如何为 Windows 和 *nix 用户部署它?
  • @AndrewThompson 此应用程序专门针对 OS X 用户。我最初用 C# 在 Windows 上创建了这个应用程序,最近决定如果我在 OS X 上使用这个应用程序会对我有好处。
  • “此应用程序专门针对 OS X 用户。” 我不会为此使用 Java。 OS X 拥有一组专为 OS X 设计的丰富 API。甚至使用本机 PLAF,并与应用程序一起部署。 bundle,典型的 Mac 用户可以分辨出两者之间的区别,并且不喜欢它的 Java 方面。

标签: java macos jar plist bundle


【解决方案1】:

请参阅原始帖子以获取解决方案。我只是不断尝试不同的 plist 键和字符串,直到一个最终起作用。我相信我现在遇到了管理问题,因为我的程序的某些部分不起作用。我将为该问题创建一个新问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-04
    • 1970-01-01
    • 2018-10-25
    • 2013-08-18
    • 2021-02-26
    • 2019-06-18
    相关资源
    最近更新 更多