aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2012-04-26 10:02:03 (EDT)
committerSilenio Quarti2012-04-26 10:03:42 (EDT)
commita6568f5db9fc6011c02f6ee6a4b28bb359e3d9ea (patch)
treed0e1743be2aa4265e7b6ea85006f2f0434c06f76
parent8cab5485f04d3173055f27a4e646df513c151310 (diff)
downloadrt.equinox.framework-a6568f5db9fc6011c02f6ee6a4b28bb359e3d9ea.zip
rt.equinox.framework-a6568f5db9fc6011c02f6ee6a4b28bb359e3d9ea.tar.gz
rt.equinox.framework-a6568f5db9fc6011c02f6ee6a4b28bb359e3d9ea.tar.bz2
Bug 377706 - x86 cocoa launcher does not start if OpenJDK 7 is installed
-rw-r--r--bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c
index 04e7298..79bed94 100644
--- a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c
+++ b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c
@@ -53,12 +53,16 @@ static char * findLib(char * command);
#ifdef i386
#define JAVA_ARCH "i386"
+#define JAVA_HOME_ARCH "i386"
#elif defined(__ppc__) || defined(__powerpc64__)
#define JAVA_ARCH "ppc"
+#define JAVA_HOME_ARCH "ppc"
#elif defined(__amd64__) || defined(__x86_64__)
#define JAVA_ARCH "amd64"
+#define JAVA_HOME_ARCH "x86_64"
#else
#define JAVA_ARCH DEFAULT_OS_ARCH
+#define JAVA_HOME_ARCH DEFAULT_OS_ARCH
#endif
#define LIB_PATH_VAR _T_ECLIPSE("LD_LIBRARY_PATH")
@@ -511,19 +515,21 @@ char * getJavaHome() {
FILE *fp;
char path[4096];
char *result, *start;
- fp = popen("/usr/libexec/java_home", "r");
+ sprintf(path, "/usr/libexec/java_home -a %s", JAVA_HOME_ARCH);
+ fp = popen(path, "r");
if (fp == NULL) {
return NULL;
}
while (fgets(path, sizeof(path)-1, fp) != NULL) {
}
- result = strdup(path);
+ result = path;
start = strchr(result, '\n');
if (start) {
start[0] = 0;
}
+ sprintf(path, "%s/bin/java", result);
pclose(fp);
- return result;
+ return strdup(path);
}
char * findVMLibrary( char* command ) {
@@ -555,21 +561,21 @@ char * findVMLibrary( char* command ) {
free(version);
}
}
- version = getJavaVersion(command);
+ char *java_home = NULL, *cmd = command;
+ if (strstr(cmd, "/JavaVM.framework/") != NULL && (strstr(cmd, "/Current/") != NULL || strstr(cmd, "/A/") != NULL)) {
+ java_home = cmd = getJavaHome();
+ }
+ version = getJavaVersion(cmd);
isJDK7 = version && versionCmp(version, "1.7.0") >= 0;
if (version) free(version);
if (isJDK7) {
- char *java_home = NULL, *cmd = command;
- if (strstr(cmd, "/JavaVM.framework/") != NULL && (strstr(cmd, "/Current/") != NULL || strstr(cmd, "/A/") != NULL)) {
- java_home = cmd = getJavaHome();
- }
start = strstr(cmd, "/Contents/");
if (start != NULL){
start[0] = 0;
return cmd;
}
- if (java_home) free(java_home);
}
+ if (java_home) free(java_home);
if (strstr(command, "/JavaVM.framework/") == NULL) {
char * lib = findLib(command);
if (lib != NULL) {