diff options
author | Silenio Quarti | 2013-02-21 16:58:31 +0000 |
---|---|---|
committer | Silenio Quarti | 2013-02-21 16:58:31 +0000 |
commit | 7c39e09970acd849024d3395bf0dd714db3ef248 (patch) | |
tree | e6e0da05ebe79c1b2b0e4a2eb07d6f40ca973fbe /bundles/org.eclipse.equinox.executable/library | |
parent | 0d5c40d55fff4174d33ec45c039837dcafa934a1 (diff) | |
download | rt.equinox.framework-7c39e09970acd849024d3395bf0dd714db3ef248.tar.gz rt.equinox.framework-7c39e09970acd849024d3395bf0dd714db3ef248.tar.xz rt.equinox.framework-7c39e09970acd849024d3395bf0dd714db3ef248.zip |
Bug 401325 - eclipse executable doesn't keep Terminal with console output connected
Diffstat (limited to 'bundles/org.eclipse.equinox.executable/library')
-rw-r--r-- | bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c index 29348fc56..9ba81bff8 100644 --- a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c +++ b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c @@ -477,6 +477,43 @@ char** getArgVM( char* vm ) return result; } +char * getJavaVersion(char* command) { + FILE *fp; + char buffer[4096]; + char *version = NULL, *firstChar; + int numChars = 0; + sprintf(buffer,"%s -version 2>&1", command); + fp = popen(buffer, "r"); + if (fp == NULL) { + return NULL; + } + while (fgets(buffer, sizeof(buffer)-1, fp) != NULL) { + if (!version) { + firstChar = (char *) (strchr(buffer, '"') + 1); + if (firstChar != NULL) + numChars = (int) (strrchr(buffer, '"') - firstChar); + + /* Allocate a buffer and copy the version string into it. */ + if (numChars > 0) + { + version = malloc( numChars + 1 ); + strncpy(version, firstChar, numChars); + version[numChars] = '\0'; + } + } + if (strstr(buffer, "Java HotSpot(TM)") || strstr(buffer, "OpenJDK")) { + isSUN = 1; + break; + } + if (strstr(buffer, "IBM") != NULL) { + isSUN = 0; + break; + } + } + pclose(fp); + return version; +} + char * getJavaHome() { FILE *fp; char path[4096]; @@ -531,11 +568,14 @@ char * findVMLibrary( char* command ) { if (strstr(cmd, "/JavaVM.framework/") != NULL && (strstr(cmd, "/Current/") != NULL || strstr(cmd, "/A/") != NULL)) { cmd = getJavaHome(); } + // This is necessary to initialize isSUN + getJavaVersion(cmd); result = JAVA_FRAMEWORK; if (strstr(cmd, "/JavaVM.framework/") == NULL) { char * lib = findLib(cmd); if (lib != NULL) { - adjustLibraryPath(lib); + // This does not seem to be necessary to load the Mac JVM library + //adjustLibraryPath(lib); result = lib; } } |