openjdk installed via homebrew
Closed this issue · 3 comments
Original report by me.
Due to licensing issues beginning with Java 11, there are folks who are migrating away from Oracle's JDK to using openjdk. It seems that if one installed openjdk using the homebrew utility, it places the JDK at, e.g., /Library/Java/JavaVirtualMachines/openjdk-11.0.1.jdk
The current version of appbundler breaks when parsing the directory name "openjdk-11.0.1.jdk", and so app launch will fail with the message stating the user needs to install Java 8 or later.
I have experienced this exact issue after removing the Oracle JDK 8 from my system.
In my testing, the problem is not the parsing of the OpenJDK directory name.
The problem is that, after extensive testing with @{557058:f47bde97-723a-4c64-a16e-f3d00f10e94f} , we have discovered that appbundler expects the Oracle JDK 8 be installed in /Library/Java/JavaVirtualMachines
or /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
, if no JRE is bundled in the app. Put another way, Appbundler doesn't check /usr/libexec/java_home
for the presence of non-Oracle JDKs that the user has chosen to install.
To reproduce, delete all traces of the Oracle JDK & JRE 8 (via these articles: 1, 2, and 3), then try to launch an appbundler-based app even with only Oracle JDK 12, OpenJDK 11+, AdoptOpenJDK 8+ or Azul Zulu JDK 8+) present. This affects versions of the appbundler-based eXist-db macOS app going back at least to February 2017.
Compare the following successful launch when Oracle JDK 8 is installed to when it has been removed:
Success
$ open /Users/joe/workspace/exist-maven/exist-distribution/target/exist-distribution-5.0.0-RC8-SNAPSHOT.app/Contents/MacOS/eXist-JavaAppLauncher
$ /Users/joe/workspace/exist-maven/exist-distribution/target/exist-distribution-5.0.0-RC8-SNAPSHOT.app/Contents/MacOS/eXist-JavaAppLauncher ; exit;
2019-05-14 00:04:44.486 eXist-JavaAppLauncher[51374:1399152] int launch(char *, int, char **)
Loading Application 'exist-distribution-5.0.0-RC8-SNAPSHOT'
2019-05-14 00:04:44.486 eXist-JavaAppLauncher[51374:1399152] int launch(char *, int, char **) Working Directory: '/Users/joe'
2019-05-14 00:04:44.487 eXist-JavaAppLauncher[51374:1399152] NSString *findJavaDylib(NSString *, _Bool, _Bool, _Bool, _Bool) Searching for a JRE.
2019-05-14 00:04:44.487 eXist-JavaAppLauncher[51374:1399152] NSString *findJavaDylib(NSString *, _Bool, _Bool, _Bool, _Bool) Searching for a Java 8
2019-05-14 00:04:44.620 eXist-JavaAppLauncher[51374:1399152] NSString *findJREDylib(int, _Bool, _Bool) Found a Java 1.8.0_211 JRE
2019-05-14 00:04:44.620 eXist-JavaAppLauncher[51374:1399152] NSString *findJREDylib(int, _Bool, _Bool) Looks like major version 8
2019-05-14 00:04:44.620 eXist-JavaAppLauncher[51374:1399152] NSString *findJREDylib(int, _Bool, _Bool) JRE version qualifies
2019-05-14 00:04:44.620 eXist-JavaAppLauncher[51374:1399152] int launch(char *, int, char **) Java Runtime Dylib Path: '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib'
2019-05-14 00:04:44.620 eXist-JavaAppLauncher[51374:1399152] int launch(char *, int, char **) Launchpath: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib
2019-05-14 00:04:44.620 eXist-JavaAppLauncher[51374:1399152] Main Bundle Path: '/Users/joe/workspace/exist-maven/exist-distribution/target/exist-distribution-5.0.0-RC8-SNAPSHOT.app'
2019-05-14 00:04:44.623 eXist-JavaAppLauncher[51374:1399152] int launch(char *, int, char **) Main Class Name: 'org.exist.start.Main'
...
Failure
$ open /Users/joe/workspace/exist-maven/exist-distribution/target/exist-distribution-5.0.0-RC8-SNAPSHOT.app/Contents/MacOS/eXist-JavaAppLauncher
$ /Users/joe/workspace/exist-maven/exist-distribution/target/exist-distribution-5.0.0-RC8-SNAPSHOT.app/Contents/MacOS/eXist-JavaAppLauncher ; exit;
2019-05-13 23:58:27.428 eXist-JavaAppLauncher[51212:1384559] int launch(char *, int, char **)
Loading Application 'exist-distribution-5.0.0-RC8-SNAPSHOT'
2019-05-13 23:58:27.429 eXist-JavaAppLauncher[51212:1384559] int launch(char *, int, char **) Working Directory: '/Users/joe'
2019-05-13 23:58:27.429 eXist-JavaAppLauncher[51212:1384559] NSString *findJavaDylib(NSString *, _Bool, _Bool, _Bool, _Bool) Searching for a JRE.
2019-05-13 23:58:27.429 eXist-JavaAppLauncher[51212:1384559] NSString *findJavaDylib(NSString *, _Bool, _Bool, _Bool, _Bool) Searching for a Java 8
2019-05-13 23:58:27.429 eXist-JavaAppLauncher[51212:1384559] NSString *findJREDylib(int, _Bool, _Bool) JRE search exception: 'launch path not accessible'
2019-05-13 23:58:27.429 eXist-JavaAppLauncher[51212:1384559] NSString *findJavaDylib(NSString *, _Bool, _Bool, _Bool, _Bool) No matching JRE found.
2019-05-13 23:58:27.429 eXist-JavaAppLauncher[51212:1384559] NSString *findJavaDylib(NSString *, _Bool, _Bool, _Bool, _Bool) A JRE is preferred; will not search for a JDK.
2019-05-13 23:58:27.429 eXist-JavaAppLauncher[51212:1384559] NSString *findJavaDylib(NSString *, _Bool, _Bool, _Bool, _Bool) No matching JRE or JDK found.
2019-05-13 23:58:27.429 eXist-JavaAppLauncher[51212:1384559] int launch(char *, int, char **) Java Runtime Dylib Path: '(null)'
2019-05-13 23:58:27.429 eXist-JavaAppLauncher[51212:1384559] int launch(char *, int, char **) Launchpath: (null)
2019-05-13 23:58:27.432 eXist-JavaAppLauncher[51212:1384559] int launch(char *, int, char **) Error launching JVM Runtime ((null)) Relative Path: '(null)' (dylib: (null))
error: This application requires that Java 8 or later be installed on your computer. Please download and install the latest version of Java from www.java.com and try again.
I hope this helps! I’m happy to provide any other info that the appbundler developers may need.
I would add that /usr/libexec/java_home
will only show those JVM's that have been registered with macOS through an installation process. You may have other JVMs in /Library/Java/JavaVirtualMachines
which it does not reveal!
You can see what is registered with: /usr/libexec/java_home -V
I believe that https://bitbucket.org/infinitekind/appbundler/pull-requests/55 fixes this issue.