Search code examples
javafxcodenameoneopenjfxjavapackagerazul-zulu

Is it possible to use javapackager on ZuluFX for Mac


I was able to use ZuluFX 8 with javapackager on Windows. However, on a Mac I get this error:

Bundler Mac Application Image skipped because of a configuration problem: Cannot determine which JRE/JDK exists in the specified runtime directory.
Advice to fix: Point the runtime directory to one of the JDK/JRE root, the Contents/Home directory of that root, or the Contents/Home/jre directory of the JDK.

It's pretty easy to just move the package into Contents/Home but I doubt that will work as it seems there is no JRE bundled with the Mac version of ZuluFX 8. Is this something that can be worked around?


Solution

  • It's pretty easy to just move the package into Contents/Home but I doubt that will work as it seems there is no JRE bundled with the Mac version of ZuluFX 8.

    From what I'm seeing, I'm not sure that's correct. The ZuluFx 8 archive for Mac contains a jre directory. I extracted the archive to ~/zuluFX and from there created the Contents/Home directory as required by MacOS and added a symbolic link to said jre directory there. I then set $JAVA_HOME accordingly:

    $ pwd
    /Users/cody/zuluFX
    $ mkdir -p Contents/Home
    $ ln -s ../../jre .
    $ export JAVA_HOME=~/zuluFX
    

    Then I utilized a simple javapackager example on github to test its usage (I have no other JREs/JDKs installed on this box). The example app simply dumps Java properties and environment variables in a TextArea.

    I had to modify the 3build script in the example to comment out its attempt to re-set $JAVA_HOME, but otherwise, it builds successfully, with the following javapackager command:

    javapackager \
      -deploy -Bruntime=${JAVA_HOME} \
      -native image \
      -srcdir . \
      -srcfiles MacJavaPropertiesApp.jar \
      -outdir release \
      -outfile ${APP_DIR_NAME} \
      -appclass MacJavaPropertiesApp \
      -name "MacJavaProperties" \
      -title "MacJavaProperties" \
      -nosign \
      -v
    

    When I launch the resulting app, it reports the usage of the azul/zulu jre as expected:

    enter image description here