简体   繁体   中英

MacOSX AppBundler Can't set Icon?

I've bundled my Java .jar file to a MacOSX .app bundle using AppBundler. Everything works, however my icon isn't loading.

This is my build.xml file:

<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. No errors are thrown indicating that the icon hasn't loaded. I just get the standard Mac app icon.

Thanks!

The icon shouldn't be inside your jar file. 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. The -Xdock:icon option is unnecessary.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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