Java Application Bundler

A mavenized version of the Java Application Bundler https://svn.java.net/svn/appbundler~svn with support of Java 9

License

License

GroupId

GroupId

com.panayotis
ArtifactId

ArtifactId

appbundler
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

Java Application Bundler
A mavenized version of the Java Application Bundler https://svn.java.net/svn/appbundler~svn with support of Java 9
Project URL

Project URL

https://github.com/teras/appbundler
Source Code Management

Source Code Management

http://github.com/teras/appbundler/tree/master

Download appbundler

How to add to project

<!-- https://jarcasting.com/artifacts/com.panayotis/appbundler/ -->
<dependency>
    <groupId>com.panayotis</groupId>
    <artifactId>appbundler</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.panayotis/appbundler/
implementation 'com.panayotis:appbundler:1.1.0'
// https://jarcasting.com/artifacts/com.panayotis/appbundler/
implementation ("com.panayotis:appbundler:1.1.0")
'com.panayotis:appbundler:jar:1.1.0'
<dependency org="com.panayotis" name="appbundler" rev="1.1.0">
  <artifact name="appbundler" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.panayotis', module='appbundler', version='1.1.0')
)
libraryDependencies += "com.panayotis" % "appbundler" % "1.1.0"
[com.panayotis/appbundler "1.1.0"]

Dependencies

provided (1)

Group / Artifact Type Version
org.apache.ant : ant jar 1.8.2

Project Modules

There are no modules declared in this project.

appbundler

A fork of the Java Application Bundler with the following changes:

  • The native binary is created as universal (32/64)
  • Fixes icon not showing bug in JavaAppLauncher
  • Adds LC_CTYPE environment variable to the Info.plist file in order to fix an issue with File.exists() in OpenJDK 7 (Contributed by Steve Hannah)
  • Allows to specify the name of the executable instead of using the default "JavaAppLauncher" (contributed by Karl von Randow)
  • Adds classpathref support to the bundleapp task
  • Adds support for JVMArchs and LSArchitecturePriority keys
  • Allows to specify a custom value for CFBundleVersion
  • Allows specifying registered file extensions using CFBundleDocumentTypes and UT[Ex|Im]portedTypeDeclarations
  • Passes to the Java application a set of system properties with the paths of the OSX special folders, whether the application is running in the sandbox (see below) and which modifier keys are held down while opening the app. With the latter, the Java application can mimic the behavior of e.g. iTunes or Photos to select another or create a new media library on startup with the option key.
  • Allows overriding of passed JVM options by the bundled app itself via java.util.Preferences (contributed by Hendrik Schreiber)
  • Allows writing arbitrary key-value pairs to Info.plist via plistentry
  • Allows setting of environment variables via Info.plist
  • Allows running the Application as privileged - e.g. for Setup (Contributed by Gerry Weißbach)
  • Allows specifying a JNLP file (jnlplaunchername) as alternative to the mainclassname which can then be launched without hassle when the Application is signed. See How to sign (dynamic) JNLP files for OSX 10.8.4 and Gatekeeper (Contributed by Gerry Weißbach)

These are the system properties passed to the JVM:

  • LibraryDirectory
  • DocumentsDirectory
  • CachesDirectory
  • ApplicationSupportDirectory
  • ApplicationDirectory
  • AutosavedInformationDirectory
  • DesktopDirectory
  • DownloadsDirectory
  • MoviesDirectory
  • MusicDirectory
  • PicturesDirectory
  • SharedPublicDirectory
  • SystemLibraryDirectory
  • SystemApplicationSupportDirectory
  • SystemCachesDirectory
  • SystemApplicationDirectory
  • SystemUserDirectory
  • UserHome (the user's home directory, even if running within a sandbox)
  • SandboxEnabled (the String true or false)
  • LaunchModifierFlagCapsLock (the String true or false)
  • LaunchModifierFlagShift (the String true or false)
  • LaunchModifierFlagControl (the String true or false)
  • LaunchModifierFlagOption (the String true or false)
  • LaunchModifierFlagCommand (the String true or false)
  • LaunchModifierFlagNumericPad (the String true or false)
  • LaunchModifierFlagHelp (the String true or false)
  • LaunchModifierFlagFunction (the String true or false)
  • LaunchModifierFlags (an Integer)

For more details, please refer to the task documentation.

Example 1:

<target name="bundle">
  <taskdef name="bundleapp" 
    classpath="appbundler-1.0ea.jar"
    classname="com.oracle.appbundler.AppBundlerTask"/>

  <bundleapp 
      classpathref="runclasspathref"
      outputdirectory="${dist}"
      name="${bundle.name}"
      displayname="${bundle.displayname}"
      executableName="MyApp"
      identifier="com.company.product"
      shortversion="${version.public}"
      version="${version.internal}"
      icon="${icons.path}/${bundle.icns}"
      mainclassname="Main"
      copyright="2012 Your Company"
      applicationCategory="public.app-category.finance">
      
      <runtime dir="${runtime}/Contents/Home"/>

      <arch name="x86_64"/>
      <arch name="i386"/>

      <bundledocument extensions="png,jpg"
        icon="${icons.path}/${image.icns}"
        name="Images"
        role="editor"
        handlerRank="owner">
      </bundledocument> 

      <bundledocument contentTypes="com.adobe.pdf"
        name="PDF files"
        role="viewer"
        handlerRank="alternate">
      </bundledocument>
      
      <bundledocument contentTypes="com.my.custom"
        name="Custom data"
        role="editor"
        exportableTypes="com.topografix.gpx">
      </bundledocument>
      
      <typedeclaration
        identifier="com.my.custom"
        description="Custom data"
        icon="${icons.path}/${data.icns}"
        conformsTo="com.apple.package"
        extensions="custom"
        mimeTypes="application/x-custom" />
    
      <typedeclaration
  	   imported = "true"
        identifier="com.topografix.gpx"
        referenceUrl="http://www.topografix.com/GPX/1/1/"
        description="GPS Exchange Format (GPX)"
        conformsTo="public.xml"
        extensions="gpx"
        mimeTypes="application/gpx+xml" />
      
      
      <!-- Define custom key-value pairs in Info.plist -->
      <plistentry key="ABCCustomKey" value="foobar"/>
      <plistentry key="ABCCustomBoolean" value="true" type="boolean"/>

      <!-- Workaround as com.apple.mrj.application.apple.menu.about.name property may no longer work -->
      <option value="-Xdock:name=${bundle.name}"/>

      <option value="-Dapple.laf.useScreenMenuBar=true"/>
      <option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
      <option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
      <option value="-Dcom.apple.mrj.application.apple.menu.about.name=${bundle.name}"/>
      <option value="-Dcom.apple.smallTabs=true"/>
      <option value="-Dfile.encoding=UTF-8"/>

      <option value="-Xmx1024M" name="Xmx"/>
  </bundleapp>
</target>

Example 2, use installed Java but require Java 8 (or later):

<target name="bundle">
  <taskdef name="bundleapp" 
    classpath="appbundler-1.0ea.jar"
    classname="com.oracle.appbundler.AppBundlerTask"/>
  <bundleapp 
      jvmrequired="1.8"
      classpathref="runclasspathref"
      outputdirectory="${dist}"
      name="${bundle.name}"
      displayname="${bundle.displayname}"
      executableName="MyApp"
      identifier="com.company.product"
      shortversion="${version.public}"
      version="${version.internal}"
      icon="${icons.path}/${bundle.icns}"
      mainclassname="Main"
      copyright="2012 Your Company"
      applicationCategory="public.app-category.finance">
  </bundleapp>
</target>

Example 2, use installed Java but require Java 8 (or later) JRE and not a JDK:

<target name="bundle">
  <taskdef name="bundleapp" 
    classpath="appbundler-1.0ea.jar"
    classname="com.oracle.appbundler.AppBundlerTask"/>
  <bundleapp 
      jvmrequired="1.8"
      jrepreferred="true"
      classpathref="runclasspathref"
      outputdirectory="${dist}"
      name="${bundle.name}"
      displayname="${bundle.displayname}"
      executableName="MyApp"
      identifier="com.company.product"
      shortversion="${version.public}"
      version="${version.internal}"
      icon="${icons.path}/${bundle.icns}"
      mainclassname="Main"
      copyright="2012 Your Company"
      applicationCategory="public.app-category.finance">
  </bundleapp>
</target>

Versions

Version
1.1.0
1.0.2
1.0.1