bundling jdk 8 with Mac OS X installer

410 views Asked by At

I have created a .pkg installer for mac using pkgbuild and product build. 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. Is there a way that bundled jdk can be put locally for that application ONLY without affecting the newer version of jdk already installed?

1

There are 1 answers

6
Franck On BEST ANSWER

You can unzip OpenJDK 8 into a non-system folder (or folder of your application) and use it without affecting other already installed JDKs. 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.

If starting your application produces an error:

Error: could not find libjava.dylib Failed to GetJREPath()

This means it uses a JDK native library directly. (See bugs.openjdk.java.net/browse/JDK-8213362 for more information.) In order to solve this either:

or:

  • set $JAVA_HOME in a script for your app.