The JRE layout in Java 9 has changed. More specifically the jre and amd64 
subfolders
have been removed. Symlinking directories to make it look like 
pre-Java9 does not work. Therefore java.so now looks at 
/usr/lib/jvm/java/lib/server/libjvm.so for alternative location of libjvm.so.

Please look here https://issues.jenkins-ci.org/browse/JENKINS-25993 for more 
information.

Also please note that the only way to run Java 9 apps on OSv is through
using java-non-isolated mode (not a default one) due to the removal
of the extension class loader and methods 
addPropertyChangeListener/removePropertyListener
in java.util.logging.LogManager. Effectively the isolated mode is a 'dead end' 
starting with Java 9 unless some significant changes are made to make it work.

Fixes #912

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
---
 modules/java-base/java.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/modules/java-base/java.cc b/modules/java-base/java.cc
index d448a3a..74e0d86 100644
--- a/modules/java-base/java.cc
+++ b/modules/java-base/java.cc
@@ -30,6 +30,7 @@ extern size_t jvm_heap_size;
 // parameters.
 
 #define JVM_PATH         "/usr/lib/jvm/jre/lib/amd64/server/libjvm.so"
+#define JVM9_PATH        "/usr/lib/jvm/java/lib/server/libjvm.so"
 
 #if defined(RUN_JAVA_NON_ISOLATED)
 #define RUNJAVA_JAR_PATH "/java/runjava-non-isolated.jar"
@@ -108,6 +109,9 @@ static int java_main(int argc, char **argv)
     auto prog = elf::get_program();
     // The JVM library remains loaded as long as jvm_so is in scope.
     auto jvm_so = prog->get_library(JVM_PATH);
+    if(!jvm_so) {
+        jvm_so = prog->get_library(JVM9_PATH);
+    }
 
     auto JNI_GetDefaultJavaVMInitArgs
         = prog->lookup_function<void (void*)>("JNI_GetDefaultJavaVMInitArgs");
-- 
2.7.4

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to