From bcec7c003442e38dd5160ff5ed394159eebeb89a Mon Sep 17 00:00:00 2001 From: Silenio Quarti Date: Wed, 26 Jun 2013 10:35:15 -0400 Subject: Bug 411361 - [Mac] Kepler doesn't launch without JRE 6, even if JDK 7 is installed --- .../library/carbon/eclipseCarbonCommon.c | 29 ++++++++++++++++------ .../library/make_version.mak | 2 +- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c index 2870c62e8..68767328b 100644 --- a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c +++ b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c @@ -120,20 +120,33 @@ static int isLibrary( _TCHAR* vm ){ return (_tcsicmp(ch, _T_ECLIPSE(".so")) == 0) || (_tcsicmp(ch, _T_ECLIPSE(".jnilib")) == 0) || (_tcsicmp(ch, _T_ECLIPSE(".dylib")) == 0); } +static void loadVMBundle( char * bundle ) { + CFURLRef url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (const UInt8 *)bundle, strlen(bundle), true); + javaVMBundle = CFBundleCreate(kCFAllocatorDefault, url); + CFRelease(url); +} + /* Load the specified shared library */ void * loadLibrary( char * library ){ if (!isLibrary(library)) { - CFURLRef url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (const UInt8 *)library, strlen(library), true); - javaVMBundle = CFBundleCreate(kCFAllocatorDefault, url); - CFRelease(url); + loadVMBundle(library); return (void*) &javaVMBundle; - } else { - void * result= dlopen(library, RTLD_NOW); - if(result == 0) - printf("%s\n",dlerror()); - return result; } + _TCHAR *bundle = strdup(library), *start; + if (strstr(bundle, "libjvm") && (start = strstr(bundle, "/Contents/")) != NULL) { + start[0] = NULL; + loadVMBundle(bundle); + free(bundle); + if (javaVMBundle) { + return (void*) &javaVMBundle; + } + } + free(bundle); + void * result= dlopen(library, RTLD_NOW); + if(result == 0) + printf("%s\n",dlerror()); + return result; } /* Unload the shared library diff --git a/bundles/org.eclipse.equinox.executable/library/make_version.mak b/bundles/org.eclipse.equinox.executable/library/make_version.mak index 1a2391d35..94682caab 100644 --- a/bundles/org.eclipse.equinox.executable/library/make_version.mak +++ b/bundles/org.eclipse.equinox.executable/library/make_version.mak @@ -10,5 +10,5 @@ #******************************************************************************* maj_ver=1 -min_ver=506 +min_ver=600 LIB_VERSION = $(maj_ver)$(min_ver) -- cgit v1.2.3