The handling of "-Dsun.java.launcher.is_altjvm=true" in os::jvm_path() is a bit broken after 8066474. The code originally intended that, if the currently loaded (alternate) libjvm.so is located inside a full and valid JRE, the path to that JRE is returned. The Code checks if the currently loaded libjvm.so is part of a jdk by traversing the pathname back 5 slashes and then checking for "/jre/lib":
2328 const char *p = buf + strlen(buf) - 1;
2329 for (int count = 0; p > buf && count < 5; ++count) {
2330 for (--p; p > buf && *p != '/'; --p)
2331 /* empty */ ;
2332 }
2333
2334 if (strncmp(p, "/jre/lib/", 9) != 0) {
That coding will not work after removal of the cpu_arch directory and needs fixing.
However, after extensive discussions (see http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2017-April/023205.html) it was decided to skip this JRE-detection altogether. -Dsun.java.launcher.is_altjvm=true is used by the gtest launcher to indicate that the path to the JRE is not to be taken from the location of the currently loaded gtest-hotspot, but from a different location. This different location is indicated via JAVA_HOME variable by the gtest launcher (which in turn is fed from the "-jdk" option of the gtest runner).
Note that this has nothing to do with the -XXaltjvm setting.
2328 const char *p = buf + strlen(buf) - 1;
2329 for (int count = 0; p > buf && count < 5; ++count) {
2330 for (--p; p > buf && *p != '/'; --p)
2331 /* empty */ ;
2332 }
2333
2334 if (strncmp(p, "/jre/lib/", 9) != 0) {
That coding will not work after removal of the cpu_arch directory and needs fixing.
However, after extensive discussions (see http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2017-April/023205.html) it was decided to skip this JRE-detection altogether. -Dsun.java.launcher.is_altjvm=true is used by the gtest launcher to indicate that the path to the JRE is not to be taken from the location of the currently loaded gtest-hotspot, but from a different location. This different location is indicated via JAVA_HOME variable by the gtest launcher (which in turn is fed from the "-jdk" option of the gtest runner).
Note that this has nothing to do with the -XXaltjvm setting.
- relates to
-
JDK-8173828 realpath is unsafe
-
- Resolved
-
-
JDK-8066474 Remove the lib/$ARCH directory from Linux and Solaris images
-
- Resolved
-
-
JDK-8171504 [aix] On AIX, -Dsun.java.launcher.is_altjvm option is ignored
-
- Resolved
-