jpl fixes

This commit is contained in:
Vitor Santos Costa 2018-12-28 17:44:28 +00:00
parent 3699a715ce
commit 3f1c2352f3
2 changed files with 19 additions and 14 deletions

View File

@ -855,8 +855,8 @@ if (WITH_JAVA)
if (APPLE) if (APPLE)
set(CMAKE_MACOSX_RPATH 1) set(CMAKE_MACOSX_RPATH 1)
find_library (JLI jli ${JAVA_AWT_DIR}/jli) find_library (JLI jli ${JAVA_AWT_DIR}/jli)
find_library (JAL JavaApplicationLauncher FRAMEWORK ONLY PATH /System/Library/PrivateFrameworks) #find_library (JAL JavaApplicationLauncher FRAMEWORK ONLY PATH /System/Library/PrivateFrameworks)
find_library (JL JavaLaunching FRAMEWORK ONLY PATH /System/Library/PrivateFrameworks) #find_library (JL JavaLaunching FRAMEWORK ONLY PATH /System/Library/PrivateFrameworks)
list(APPEND CMAKE_INSTALL_RPATH ${JAVA_AWT_DIR}/jli) list(APPEND CMAKE_INSTALL_RPATH ${JAVA_AWT_DIR}/jli)
list(APPEND JNI_LIBRARIES ${JLI};${JAL};${JL}) list(APPEND JNI_LIBRARIES ${JLI};${JAL};${JL})
endif() endif()

View File

@ -48,6 +48,8 @@ refactoring (trivial):
#define JPL_C_LIB_VERSION_PATCH 4 #define JPL_C_LIB_VERSION_PATCH 4
#define JPL_C_LIB_VERSION_STATUS "alpha" #define JPL_C_LIB_VERSION_STATUS "alpha"
#define JPL_DEBUG
#ifndef JPL_DEBUG #ifndef JPL_DEBUG
/*#define DEBUG(n, g) ((void)0) */ /*#define DEBUG(n, g) ((void)0) */
#define DEBUG_LEVEL 4 #define DEBUG_LEVEL 4
@ -640,7 +642,7 @@ static JNIEnv*
jni_env(void) /* economically gets a JNIEnv pointer, valid for this thread */ jni_env(void) /* economically gets a JNIEnv pointer, valid for this thread */
{ JNIEnv *env; { JNIEnv *env;
switch( (*jvm)->GetEnv(jvm, (void**)&env, JNI_VERSION_1_8) ) switch( (*jvm)->GetEnv(jvm, (void**)&env, JNI_VERSION_9) )
{ case JNI_OK: { case JNI_OK:
return env; return env;
case JNI_EDETACHED: case JNI_EDETACHED:
@ -1819,17 +1821,17 @@ jni_create_jvm_c(
char *cpoptp; char *cpoptp;
JavaVMOption opt[MAX_JVM_OPTIONS]; JavaVMOption opt[MAX_JVM_OPTIONS];
int r; int r;
jint n; jint n = 1;
int optn = 0; int optn = 0;
JNIEnv *env; JNIEnv *env;
JPL_DEBUG(1, Sdprintf( "[creating JVM with 'java.class.path=%s']\n", classpath)); JPL_DEBUG(1, Sdprintf( "[creating JVM with 'java.class.path=%s']\n", classpath));
vm_args.version = JNI_VERSION_1_6; /* "Java 1.2 please" */ vm_args.version = JNI_VERSION_1_6zzzz; /* "Java 1.2 please" */
if ( classpath ) if ( classpath )
{ {
cpoptp = (char *)malloc(strlen(classpath)+20); cpoptp = (char *)malloc(strlen(classpath) + strlen("-Djava.class.path=")+1);
strcpy( cpoptp, "-Djava.class.path="); /* was cpopt */ strcpy(cpoptp, "-Djava.class.path="); /* was cpopt */
strcat( cpoptp, classpath); /* oughta check length... */ strcat(cpoptp, classpath); /* oughta check length... */
vm_args.options = opt; vm_args.options = opt;
opt[optn].optionString = cpoptp; /* was cpopt */ opt[optn].optionString = cpoptp; /* was cpopt */
optn++; optn++;
@ -1841,10 +1843,12 @@ jni_create_jvm_c(
/* opt[optn++].extraInfo = jvm_abort; // this function has been moved to jpl_extras.c */ /* opt[optn++].extraInfo = jvm_abort; // this function has been moved to jpl_extras.c */
/* opt[optn++].optionString = "-Xcheck:jni"; // extra checking of JNI calls */ /* opt[optn++].optionString = "-Xcheck:jni"; // extra checking of JNI calls */
#if __YAP_PROLOG__ #if __YAP_PROLOG__
opt[optn++].optionString = "-Xmx512m"; // give java enough space opt[optn].optionString = malloc(strlen("-Xmx512m")+1); // give java enough space
strcpy(opt[optn++].optionString,"-Xmx512m"); // give java enough space
#if defined(__APPLE__) #if defined(__APPLE__)
// I can't make jpl work with AWT graphics, without creating the extra thread. // I can't make jpl work with AWT graphics, without creating the extra thread.
opt[optn++].optionString = "-Djava.awt.headless=true"; opt[optn].optionString = malloc(strlen("-Djava.awt.headless=true") + 1); // give java enough space
strcpy(opt[optn++].optionString, "-Djava.awt.headless=true"); // give java enough space
#endif #endif
// opt[optn++].optionString = "-XstartOnFirstThread"; // opt[optn++].optionString = "-XstartOnFirstThread";
#endif #endif
@ -1853,6 +1857,7 @@ jni_create_jvm_c(
/* opt[optn++].extraInfo = fprintf; // no O/P, then SEGV */ /* opt[optn++].extraInfo = fprintf; // no O/P, then SEGV */
/* opt[optn++].extraInfo = xprintf; // one message, then SEGV */ /* opt[optn++].extraInfo = xprintf; // one message, then SEGV */
/* opt[optn++].optionString = "-verbose:jni"; */ /* opt[optn++].optionString = "-verbose:jni"; */
opt[optn].optionString = NULL;
if ( jvm_dia != NULL ) if ( jvm_dia != NULL )
{ {