From 5fff7be5e1d0640bddcfe8bd9eb01e5b7ccb9b9c Mon Sep 17 00:00:00 2001 From: Damjan Jovanovic Date: Wed, 26 Sep 2007 15:13:47 +0000 Subject: [PATCH] Reduced JNI version from 1_6 to 1_4, and used javac and jar in PATH not in JAVA_HOME to build (on MacOS) git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5759 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/languages/mod_java/Makefile.in | 5 ++--- src/mod/languages/mod_java/freeswitch_java.cpp | 10 +++++----- src/mod/languages/mod_java/mod_java.c | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/mod/languages/mod_java/Makefile.in b/src/mod/languages/mod_java/Makefile.in index 9bf063df8b..49a6b209a1 100644 --- a/src/mod/languages/mod_java/Makefile.in +++ b/src/mod/languages/mod_java/Makefile.in @@ -4,7 +4,6 @@ # and define these variables to impact your build JAVA_FLAGS=@JAVA_FLAGS@ -JAVA_HOME=@JAVA_HOME@ # Without -fno-strict-aliasing, g++ generates invalid code for Java_org_freeswitch_freeswitchJNI_SWIGJavaSessionUpcast, which segfaults LOCAL_CFLAGS=$(JAVA_FLAGS) -fno-strict-aliasing LOCAL_OBJS=freeswitch_java.o switch_swig_wrap.o @@ -19,8 +18,8 @@ include ../../../../build/modmake.rules local_depend: mkdir -p classes - $(JAVA_HOME)/bin/javac -sourcepath src -d classes $(CLASSES) - $(JAVA_HOME)/bin/jar cf freeswitch.jar -C classes org + javac -sourcepath src -d classes $(CLASSES) + jar cf freeswitch.jar -C classes org reswig: rm -f switch_swig_wrap.cpp diff --git a/src/mod/languages/mod_java/freeswitch_java.cpp b/src/mod/languages/mod_java/freeswitch_java.cpp index cff737b120..6d7992daae 100644 --- a/src/mod/languages/mod_java/freeswitch_java.cpp +++ b/src/mod/languages/mod_java/freeswitch_java.cpp @@ -17,7 +17,7 @@ JavaSession::~JavaSession() JNIEnv *env; jint res; - res = javaVM->GetEnv((void**)&env, JNI_VERSION_1_6); + res = javaVM->GetEnv((void**)&env, JNI_VERSION_1_4); if (res == JNI_OK) { if (cb_state.function) @@ -57,7 +57,7 @@ void JavaSession::setDTMFCallback(jobject dtmfCallback, char *funcargs) jobject globalArgs = NULL; jint res; - res = javaVM->GetEnv((void**)&env, JNI_VERSION_1_6); + res = javaVM->GetEnv((void**)&env, JNI_VERSION_1_4); if (res != JNI_OK) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error getting JNIEnv!\n"); @@ -104,7 +104,7 @@ void JavaSession::setHangupHook(jobject hangupHook) jobject globalHangupHook; jint res; - res = javaVM->GetEnv((void**)&env, JNI_VERSION_1_6); + res = javaVM->GetEnv((void**)&env, JNI_VERSION_1_4); if (res != JNI_OK) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error getting JNIEnv!\n"); @@ -143,7 +143,7 @@ void JavaSession::check_hangup_hook() return; } - res = javaVM->GetEnv((void**)&env, JNI_VERSION_1_6); + res = javaVM->GetEnv((void**)&env, JNI_VERSION_1_4); if (res == JNI_EDETACHED) { res = javaVM->AttachCurrentThread((void**)&env, NULL); @@ -185,7 +185,7 @@ switch_status_t JavaSession::run_dtmf_callback(void *input, switch_input_type_t return SWITCH_STATUS_FALSE; } - res = javaVM->GetEnv((void**)&env, JNI_VERSION_1_6); + res = javaVM->GetEnv((void**)&env, JNI_VERSION_1_4); if (res != JNI_OK) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error getting JNIEnv!\n"); diff --git a/src/mod/languages/mod_java/mod_java.c b/src/mod/languages/mod_java/mod_java.c index 028170559b..2b4b0d417d 100644 --- a/src/mod/languages/mod_java/mod_java.c +++ b/src/mod/languages/mod_java/mod_java.c @@ -229,7 +229,7 @@ static switch_status_t create_java_vm(JavaVMOption *options, int optionCount) jint res; memset(&initArgs, 0, sizeof(initArgs)); - initArgs.version = JNI_VERSION_1_6; + initArgs.version = JNI_VERSION_1_4; initArgs.nOptions = optionCount; initArgs.options = options; initArgs.ignoreUnrecognized = JNI_TRUE;