简体   繁体   English

将 jdk 8 与 Mac OS X 安装程序捆绑在一起

[英]bundling jdk 8 with Mac OS X installer

I have created a.pkg installer for mac using pkgbuild and product build.我使用 pkgbuild 和产品构建为 mac 创建了一个 .pkg 安装程序。 Is there a way to bundle java jdk 8 along with the package. Say newer version of java is already installed on Mac and my application is compatible with jdk 8 only.有没有办法将 java jdk 8 与 package 捆绑在一起。说 java 的较新版本已经安装在 Mac 上,我的应用程序仅与 jdk 8 兼容。 Is there a way that bundled jdk can be put locally for that application ONLY without affecting the newer version of jdk already installed?有没有一种方法可以在不影响已安装的较新版本的 jdk 的情况下,只为该应用程序在本地放置捆绑的 jdk?

You can unzip OpenJDK 8 into a non-system folder (or folder of your application) and use it without affecting other already installed JDKs.您可以将 OpenJDK 8 解压缩到非系统文件夹(或您的应用程序的文件夹)并使用它,而不会影响其他已安装的 JDK。 There is no need for an installation or modification of global environment variables.无需安装或修改全局环境变量。 Therefore, technically it is not a problem.所以,技术上是没有问题的。

Note: Oracle's (not open) JDK has different rules regarding installation and distribution.注意:Oracle 的(未开放的)JDK 在安装和分发方面有不同的规则。

If starting your application produces an error:如果启动您的应用程序产生错误:

Error: could not find libjava.dylib Failed to GetJREPath()错误:找不到 libjava.dylib GetJREPath() 失败

This means it uses a JDK native library directly.这意味着它直接使用 JDK 本机库。 (See bugs.openjdk.java.net/browse/JDK-8213362 for more information.) In order to solve this either: (有关更多信息,请参阅bugs.openjdk.java.net/browse/JDK-8213362 。)为了解决此问题:

or:或者:

  • set $JAVA_HOME in a script for your app.在您的应用程序的脚本中设置$JAVA_HOME

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM