Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun Thondapu2017-04-25 11:03:14 +0000
committerArun Thondapu2017-04-28 19:00:53 +0000
commit2e0869c0e8cf5f4125a3237f22ed6f166a065fbb (patch)
tree5ac226ad931803bbbb70938f9c2effba1173bb2a /features/org.eclipse.equinox.executable.feature/library/win32
parent08ca11dfd2d83f932e5f565e1c11a8fdb49a6e6a (diff)
downloadrt.equinox.framework-2e0869c0e8cf5f4125a3237f22ed6f166a065fbb.tar.gz
rt.equinox.framework-2e0869c0e8cf5f4125a3237f22ed6f166a065fbb.tar.xz
rt.equinox.framework-2e0869c0e8cf5f4125a3237f22ed6f166a065fbb.zip
Bug 493761: Platform won't launch on Java 9-ea builds
(InjectionException: NoClassDefFoundError: javax/annotation/PostConstruct) --add-modules VM argument is needed to run eclipse with Java 9 but Java 8 does not recognize this argument and fails to start up. This patch prevents passing the --add-modules argument to the JVM if it is present in the VM argument list and the JVM version is < 9. Tested with different builds of Java 8 and Java 9 on Linux, Mac and Windows. Also tested with both formats of specifying the argument (one-arg with "=", or two-arg). Change-Id: I0d4c6ba2ba0e41982a89d7da1aef6c78f276f65c Signed-off-by: Arun Thondapu <arunkumar.thondapu@in.ibm.com>
Diffstat (limited to 'features/org.eclipse.equinox.executable.feature/library/win32')
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/win32/eclipseWin.c31
1 files changed, 9 insertions, 22 deletions
diff --git a/features/org.eclipse.equinox.executable.feature/library/win32/eclipseWin.c b/features/org.eclipse.equinox.executable.feature/library/win32/eclipseWin.c
index 4df9e99dd..73a394344 100644
--- a/features/org.eclipse.equinox.executable.feature/library/win32/eclipseWin.c
+++ b/features/org.eclipse.equinox.executable.feature/library/win32/eclipseWin.c
@@ -77,10 +77,7 @@ typedef struct {
WORD codepage;
} TRANSLATIONS;
-#define COMPANY_NAME_KEY _T_ECLIPSE("\\StringFileInfo\\%04x%04x\\CompanyName")
#define PRODUCT_VERSION_KEY _T_ECLIPSE("\\StringFileInfo\\%04x%04x\\ProductVersion")
-#define SUN_MICROSYSTEMS _T_ECLIPSE("Sun Microsystems")
-#define ORACLE _T_ECLIPSE("Oracle")
static void sendOpenFileMessage(HWND window) {
_TCHAR* id;
@@ -600,16 +597,16 @@ JavaResults* startJavaVM( _TCHAR* libPath, _TCHAR* vmArgs[], _TCHAR* progArgs[],
return startJavaJNI(libPath, vmArgs, progArgs, jarFile);
}
-int isMaxPermSizeVM( _TCHAR * javaVM, _TCHAR * jniLib ) {
+/* returns 1 if the JVM version is >= 9, 0 otherwise */
+int isModularVM( _TCHAR * javaVM, _TCHAR * jniLib ) {
_TCHAR *vm = (jniLib != NULL) ? jniLib : javaVM;
int result = 0;
DWORD infoSize;
DWORD handle;
void * info;
- _TCHAR *key, *value, *versionKey, *version, *majorVersion = NULL;
- size_t i;
- int valueSize, versionSize;
+ _TCHAR *versionKey, *version, *majorVersion = NULL;
+ int versionSize;
if (vm == NULL)
return 0;
@@ -623,25 +620,15 @@ int isMaxPermSizeVM( _TCHAR * javaVM, _TCHAR * jniLib ) {
VerQueryValue(info, _T_ECLIPSE("\\VarFileInfo\\Translation"), (void *) &translations, &translationsSize);
/* this size is only right because %04x is 4 characters */
- key = malloc((_tcslen(COMPANY_NAME_KEY) + 1) * sizeof(_TCHAR));
versionKey = malloc((_tcslen(PRODUCT_VERSION_KEY) + 1) * sizeof(_TCHAR));
- for (i = 0; i < (translationsSize / sizeof(TRANSLATIONS)); i++) {
- _stprintf(key, COMPANY_NAME_KEY, translations[i].language, translations[i].codepage);
- VerQueryValue(info, key, (void *)&value, &valueSize);
-
- if ((_tcsncmp(value, SUN_MICROSYSTEMS, _tcslen(SUN_MICROSYSTEMS)) == 0) || (_tcsncmp(value, ORACLE, _tcslen(ORACLE)) == 0)) {
- _stprintf(versionKey, PRODUCT_VERSION_KEY, translations[i].language, translations[i].codepage);
- VerQueryValue(info, versionKey, (void *)&version, &versionSize);
- if (versionSize > 1) {
- majorVersion = _tcstok(version, ".");
- }
- if ((majorVersion != NULL) && (_tcstol(majorVersion, NULL, 10) < 8)) {
+ _stprintf(versionKey, PRODUCT_VERSION_KEY, translations[0].language, translations[0].codepage);
+ VerQueryValue(info, versionKey, (void *)&version, &versionSize);
+ if (versionSize >= 1) {
+ majorVersion = _tcstok(version, ".-");
+ if ((majorVersion != NULL) && (_tcstol(majorVersion, NULL, 10) >= 9)) {
result = 1;
}
- break;
}
- }
- free(key);
free(versionKey);
}
free(info);

Back to the top