Convert Java to .app file for MacOSX using JarBundler

前端 未结 3 479
温柔的废话
温柔的废话 2020-12-14 10:50

All I\'m trying to do is convert a simple java program into a macOSX .app file so I can distribute it as a simple executable file.

I\'ve read all over the place and

相关标签:
3条回答
  • 2020-12-14 11:32

    If you want to use Oracle Java instead of Apple's discontinued Java, you should use Java Application Bundler instead of JarBundler.

    See also these answers:

    • Application is using Java 6 from Apple instead of Java 7 from Oracle on Mac OS X?
    • Bundle a Java 7 .jar for Mac
    0 讨论(0)
  • 2020-12-14 11:34

    Worked for me! For some reason I couldn't put the jarbundler .jar file in the Ant area, but instead had to point at it explicitly from the build.xml (I put it in <projectRoot>/jarbundler/jarbundler-2.2.0.jar). My build.xml looked like:

    <?xml version="1.0" encoding="UTF-8"?>
    <project name="TripleWhammy" default="default" basedir=".">        
        <taskdef name="jarbundler"
                 classname="net.sourceforge.jarbundler.JarBundler"
                 classpath="jarbundler/jarbundler-2.2.0.jar" />
    
        <target name="bundle">
            <jarbundler dir="."
                        name="Triple Whammy"
                        mainclass="org.bigclue.TripleWhammy"
                        jar="target/triple-whammy-1.0-jar-with-dependencies.jar"
                        icon="triple-whammy.icns"/>
        </target>
    </project>
    

    This created "Triple Whammy.app" in my project directory. My icon looks good. Sweet.

    Now that I've built a simple distributable dice .app, time to build something awesome...

    (Mac OS X 10.6.8, Java 1.6.0_51, Ant 1.8.4; built my .jar using Maven 3.0.4 and its "assembly" plugin version 2.4).

    0 讨论(0)
  • 2020-12-14 11:41

    On Mac OS X, an application bundle is a directory that has a name ending in .app and that contains the resources used by the application. This game is an example that constructs the bundle in situ using an ant build script. Additional references are cited here.

    0 讨论(0)
提交回复
热议问题