Bug 444201 - Make embedded JVM work again on MacOS
With the new native MacOS file system layout (bug 431116) any embedded JVM
will fail to start. Reason is a too simple detection of the JVM bundle
based on the existence of a /Contents/ path segment, which now happens to
always be there and causes the JVM to be loaded at the Eclipse.app/ location
instead of at the embedded JVM bundle location. Fix is to check for
/Contents/Home/ which should be unique enough for MacOS JVM bundles.
This also fixes bug 442324's issue of a wrongly required legacy Apple JVM even
if a JVM is embedded.
Bug: 442324
Bug: 444201
Change-Id: I72b55b1f6dfdbd9d08db605308a2ec4456edf858
Signed-off-by: Christian Georgi <christian.georgi@sap.com>
diff --git a/features/org.eclipse.equinox.executable.feature/library/carbon/eclipseCarbonCommon.c b/features/org.eclipse.equinox.executable.feature/library/carbon/eclipseCarbonCommon.c
index 6876732..75369f1 100644
--- a/features/org.eclipse.equinox.executable.feature/library/carbon/eclipseCarbonCommon.c
+++ b/features/org.eclipse.equinox.executable.feature/library/carbon/eclipseCarbonCommon.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * Copyright (c) 2006, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -133,8 +133,11 @@
loadVMBundle(library);
return (void*) &javaVMBundle;
}
+
_TCHAR *bundle = strdup(library), *start;
- if (strstr(bundle, "libjvm") && (start = strstr(bundle, "/Contents/")) != NULL) {
+
+ // check if it's a JVM bundle
+ if (strstr(bundle, "libjvm") && (start = strstr(bundle, "/Contents/Home/")) != NULL) {
start[0] = NULL;
loadVMBundle(bundle);
free(bundle);
@@ -142,6 +145,7 @@
return (void*) &javaVMBundle;
}
}
+
free(bundle);
void * result= dlopen(library, RTLD_NOW);
if(result == 0)