commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1814446 - /commons/proper/daemon/trunk/src/native/windows/src/javajni.c
Date Mon, 06 Nov 2017 23:37:58 GMT
Author: markt
Date: Mon Nov  6 23:37:58 2017
New Revision: 1814446

URL: http://svn.apache.org/viewvc?rev=1814446&view=rev
Log:
Add code to detect if Java 9 is being used in jvm mode and include a place-holder for where
the Java 9 options will need to be added.

Modified:
    commons/proper/daemon/trunk/src/native/windows/src/javajni.c

Modified: commons/proper/daemon/trunk/src/native/windows/src/javajni.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/windows/src/javajni.c?rev=1814446&r1=1814445&r2=1814446&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/windows/src/javajni.c (original)
+++ commons/proper/daemon/trunk/src/native/windows/src/javajni.c Mon Nov  6 23:37:58 2017
@@ -29,6 +29,13 @@
 
 #define JNI_VERSION_DEFAULT JNI_VERSION_1_6
 
+/* Need to be able to detect Java 9 without requiring compilation against Java 9
+ * headers.
+ */
+#ifndef JNI_VERSION_9
+#define JNI_VERSION_9  0x00090000
+#endif
+
 /* Standard jvm.dll prototypes
  * since only single jvm can exist per process
  * make those global
@@ -613,6 +620,20 @@ static LPSTR __apxEvalClasspath(APXHANDL
         return pCpy;
 }
 
+BOOL
+__apxIsJavaNine()
+{
+    JavaVMInitArgs  vmArgs;
+    vmArgs.version = JNI_VERSION_9;
+    /* Returns an error if requested version is not supported */
+    if (DYNLOAD_FPTR(JNI_GetDefaultJavaVMInitArgs)(&vmArgs) != JNI_OK) {
+        return FALSE;
+    }
+    else {
+        return TRUE;
+    }
+}
+
 /* ANSI version only */
 BOOL
 apxJavaInitialize(APXHANDLE hJava, LPCSTR szClassPath,
@@ -624,6 +645,7 @@ apxJavaInitialize(APXHANDLE hJava, LPCST
     JavaVMOption    *lpJvmOptions;
     DWORD           i, nOptions, sOptions = 0;
     BOOL            rv = FALSE;
+
     if (hJava->dwType != APXHANDLE_TYPE_JVM)
         return FALSE;
 
@@ -664,6 +686,10 @@ apxJavaInitialize(APXHANDLE hJava, LPCST
         if (szClassPath && *szClassPath)
             ++sOptions;
 
+        if (__apxIsJavaNine()) {
+            apxLogWrite(APXLOG_MARK_ERROR "TODO: Merge additional Java 9 JVM options");
+        }
+
         sOptions++; /* unconditionally set for extraInfo exit  */
         sOptions++; /* unconditionally set for extraInfo abort */
 



Mime
View raw message