Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I build an OS X Java Application Bundle in IntelliJ IDEA?

I'm trying to build a Java application for the mac in IntelliJ IDEA. The Apple Developer docs say I need to make a Java Application Bundle in order to support things like dock icons, application names etc, but I'm not sure how to set up a build configuration to do all this from within IntelliJ. Can anybody shed some light on this?

like image 230
brendanzab Avatar asked Feb 04 '26 04:02

brendanzab


2 Answers

Here's how I dit it (MacOS 10.10 + IntelliJ IDEA 15 + JDK 1.8):

  1. Download Oracle Java Application Bundler and place copy it into /lib directory of your project.
  2. FileProject StructureArtifactsAdd (+)JARFrom modules With Dependecies... → Choose Main class → OK.
  3. BuildBuild Artifacts... → Generate jar in /out/artifacts/...
  4. Create build.xml at your project's root:

    <?xml version="1.0" encoding="UTF-8"?>
    <project name="Test" default="bundle-test" basedir=".">
        <taskdef name="bundleapp" 
            classname="com.oracle.appbundler.AppBundlerTask" 
            classpath="lib/appbundler-1.0.jar" />    
        <target name="bundle-test">
            <bundleapp outputdirectory="out"
                name="Test"
                displayname="Test"
                identifier="Test"
                mainclassname="Main">
                <classpath file="out/artifacts/test_jar/test.jar" />
            </bundleapp>
        </target>
    </project>
    
  5. At the Ant Build panel (ViewTool WindowsAnt Build) click Add (+) and chose your build.xml and press Run button.
  6. Find your app in /out directory of your project.
like image 131
Oleg Mikhailov Avatar answered Feb 05 '26 20:02

Oleg Mikhailov


IntelliJ IDEA doesn't support creating such bundles. You can use Ant or some external tool to automate this process.

like image 40
CrazyCoder Avatar answered Feb 05 '26 21:02

CrazyCoder