Search code examples
javamacoscocoaapp-bundle

AppBundler doesn't include binaries from JRE in OS X Java App


I'm trying to to package my java app into an OS X App Bundle and I want to include the JRE, so it can run without a installed JRE.

I'm following http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html

The AppBundler Ant Task will generate a .app with the JRE included but it is missing all the binaries.

The App will run but i'm not sure it's not using my installed JRE instead as it's missing the binaries. Or does the included JavaAppLauncher replaces the normal java binary?


Solution

  • The bin/ folder is not included when bundling the JRE in an app. The only native binaries it uses are in MyApp/Contents/MacOS and MyApp/Contents/Plugins/MyJRE/Contents/MacOS.

    Or does the included JavaAppLauncher replaces the normal java binary?

    The app bundle does not call a 'java' command. Some combination of JavaAppLauncher and libjli.dylib invokes Java dynamically.

    If you are unsure if it is using the bundled version of Java, output this when your app runs. It will tell you from what location Java is being called:

    System.getProperty("java.home", "")