简体   繁体   English

MacOSX AppBundler无法设置图标?

[英]MacOSX AppBundler Can't set Icon?

I've bundled my Java .jar file to a MacOSX .app bundle using AppBundler. 我已经使用AppBundler将Java .jar文件捆绑到MacOSX .app捆绑包中。 Everything works, however my icon isn't loading. 一切正常,但是我的图标没有加载。

This is my build.xml file: 这是我的build.xml文件:

<project name="Rage Mage" basedir="." default="bundle-RageMage">
<taskdef name="bundleapp"
         classname="com.oracle.appbundler.AppBundlerTask"   
         classpath="lib/appbundler-1.0.jar" />

<target name="bundle-RageMage">
    <delete dir="appBundle" failonerror="false"/>
    <mkdir dir="appBundle"/>
    <bundleapp outputdirectory="appBundle"
        name="Rage Mage"
        displayname="Rage Mage"
        identifier="Rage Mage"
        icon="res/icon.icns"
        shortversion="Beta 1.1.1"
        mainclassname="ragemage.src.Window">
        <runtime dir="/Library/Java/JavaVirtualMachines/jdk1.7.0_65.jdk/Contents/Home"/>
        <option value="-Xdock:icon=res/icon.icns"></option>
        <classpath file="dist/ragemage_beta1.1.1.jar" />
    </bundleapp>
</target>

The icon.icns file is in my .jar 's res folder. icon.icns文件位于我的.jarres文件夹中。 No errors are thrown indicating that the icon hasn't loaded. 不会引发任何错误,表明该图标尚未加载。 I just get the standard Mac app icon. 我只是得到标准的Mac应用程序图标。

Thanks! 谢谢!

The icon shouldn't be inside your jar file. 该图标不应位于您的jar文件中。 The icon attribute should be a path to the icon file on disk, typically relative to the location of build.xml, and it will be copied to the right place inside the generated bundle directory by the appbundler task. icon属性应该是磁盘上图标文件的路径,通常是相对于build.xml的位置,并且appbundler任务会将其复制到生成的bundle目录中的正确位置。 The -Xdock:icon option is unnecessary. -Xdock:icon选项是不必要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM