Mac 是否可以在 ZuluFX 上使用 javapackager

Is it possible to use javapackager on ZuluFX for Mac

我能够在 Windows 上将 ZuluFX 8 与 javapackager 结合使用。但是,在 Mac 上我得到这个错误:

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.

将包移动到 Contents/Home 中非常容易,但我怀疑这是否可行,因为似乎没有与 Mac 版本的 ZuluFX 8 捆绑的 JRE。这是否可以解决办法?

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.

据我所知,我不确定这是否正确。 ZuluFx 8 archive for Mac 包含一个 jre 目录。我将存档解压缩到 ~/zuluFX,然后根据 MacOS 的要求从那里创建了 Contents/Home 目录,并在其中的 jre 目录中添加了一个符号 link。然后我相应地设置 $JAVA_HOME :

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

然后我在github上使用了一个简单的javapackager example来测试它的使用(我没有在这个盒子上安装其他JREs/JDKs)。示例应用只是将 Java 属性和环境变量转储到 TextArea 中。

我不得不修改示例中的 3build 脚本以注释掉它试图重新设置 $JAVA_HOME,但除此之外,它构建成功,使用以下 javapackager 命令:

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

当我启动生成的应用程序时,它会按预期报告 azul/zulu jre 的使用情况: