JDK-8211959 : JLI_Launch unable to launch a JVM on Mac following the fix for JDK-8210931
  • Type: Bug
  • Component: tools
  • Sub-Component: launcher
  • Affected Version: 12
  • Priority: P2
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2018-10-09
  • Updated: 2018-11-28
  • Resolved: 2018-11-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 12
12Resolved
Related Reports
Duplicate :  
Relates :  
Description
We are unable to use JLI_Launch to launch a JVM on Mac following the fix for JDK-8210931. This is causing an application launcher created by jpackager, which is under development in the 'JDK-8200758-branch' branch of the jdk/sandbox repo, to fail to launch with the following error:

Error: could not find libjava.dylib
Error: Could not find Java SE Runtime Environment.

This is due to the following, which should have been changed at the same time:

src/java.base/macosx/native/libjli/java_md_macosx.m:    const char lastPathComponent[] = "/lib/jli/libjli.dylib";

I grepped the sources and found the following which also should be examined:

src/java.base/unix/native/libjli/java_md_solinux.c:                    JLI_StrLen(jrepath) + JLI_StrLen("/lib//jli:") +
src/java.base/unix/native/libjli/java_md_solinux.c:                        "%s/lib/jli:" /* Needed on AIX because ld doesn't support $ORIGIN. */
test/hotspot/gtest/gtestMain.cpp:  size_t len = strlen(java_home) + strlen("/lib/jli/libjli.dylib") + 1;
test/hotspot/gtest/gtestMain.cpp:  snprintf(path, len, "%s/lib/jli/libjli.dylib", java_home);

Comments
Mark as duplicate with JDK-8213362
28-11-2018

The following patch is sufficient to get jpackager to run again (so we will apply it locally in our sandbox branch until fixed). diff --git a/src/java.base/macosx/native/libjli/java_md_macosx.m b/src/java.base/macosx/native/libjli/java_md_macosx.m --- a/src/java.base/macosx/native/libjli/java_md_macosx.m +++ b/src/java.base/macosx/native/libjli/java_md_macosx.m @@ -508,7 +508,7 @@ return JNI_FALSE; } - const char lastPathComponent[] = "/lib/jli/libjli.dylib"; + const char lastPathComponent[] = "/lib/libjli.dylib"; size_t sizeOfLastPathComponent = sizeof(lastPathComponent) - 1; if (pathLen < sizeOfLastPathComponent) { return JNI_FALSE;
09-10-2018

The fact that this wasn't caught suggests that there is no test for this mode of calling JLI_Launch.
09-10-2018