[libbluray-devel] bdj: JVM option -Xbootclasspath does not exist in Java 9

hpi1 git at videolan.org
Sun Sep 2 17:27:32 CEST 2018


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Sep  2 18:10:47 2018 +0300| [a90f987c1125164a8bd8b754f387c35c0e45243b] | committer: hpi1

bdj: JVM option -Xbootclasspath does not exist in Java 9

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=a90f987c1125164a8bd8b754f387c35c0e45243b
---

 src/libbluray/bdj/bdj.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/libbluray/bdj/bdj.c b/src/libbluray/bdj/bdj.c
index 456026ec..2b8decf4 100644
--- a/src/libbluray/bdj/bdj.c
+++ b/src/libbluray/bdj/bdj.c
@@ -750,7 +750,7 @@ static int _create_jvm(void *jvm_lib, const char *java_home, const char *jar_fil
 
     fptr_JNI_CreateJavaVM JNI_CreateJavaVM_fp;
     JavaVMOption option[20];
-    int n = 0, result;
+    int n = 0, result, java_9;
     JavaVMInitArgs args;
 
     *(void **)(&JNI_CreateJavaVM_fp) = dl_dlsym(jvm_lib, "JNI_CreateJavaVM");
@@ -759,12 +759,19 @@ static int _create_jvm(void *jvm_lib, const char *java_home, const char *jar_fil
         return 0;
     }
 
+#ifdef HAVE_BDJ_J2ME
+    java_9 = 0;
+#else
+    java_9 = !!dl_dlsym(jvm_lib, "JVM_DefineModule");
+    if (java_9) {
+        BD_DEBUG(DBG_CRIT | DBG_BDJ, "Detected Java 9 or later JVM - support is experimental !\n");
+    }
+#endif
+
     memset(option, 0, sizeof(option));
 
     option[n++].optionString = str_dup   ("-Dawt.toolkit=java.awt.BDToolkit");
     option[n++].optionString = str_dup   ("-Djava.awt.graphicsenv=java.awt.BDGraphicsEnvironment");
-    option[n++].optionString = str_dup   ("-Djavax.accessibility.assistive_technologies= ");
-    option[n++].optionString = str_printf("-Xbootclasspath/p:%s", jar_file);
     option[n++].optionString = str_dup   ("-Xms256M");
     option[n++].optionString = str_dup   ("-Xmx256M");
     option[n++].optionString = str_dup   ("-Xss2048k");
@@ -774,7 +781,15 @@ static int _create_jvm(void *jvm_lib, const char *java_home, const char *jar_fil
     option[n++].optionString = str_dup   ("-XfullShutdown");
 #endif
 
+    if (!java_9) {
+      option[n++].optionString = str_dup   ("-Djavax.accessibility.assistive_technologies= ");
+      option[n++].optionString = str_printf("-Xbootclasspath/p:%s", jar_file);
+    } else {
+      option[n++].optionString = str_printf("--patch-module=java.base=%s", jar_file);
+    }
+
     /* JVM debug options */
+
     if (getenv("BDJ_JVM_DEBUG")) {
         option[n++].optionString = str_dup("-ea");
         //option[n++].optionString = str_dup("-verbose");



More information about the libbluray-devel mailing list