aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTill Brychcy2018-07-16 16:12:49 -0400
committerTill Brychcy2018-07-16 16:20:48 -0400
commit132d809466703c06a758fc86f8ae5ad7cb9f4954 (patch)
tree0e2018da8daf53577cd20cbea4505a2b48528ea8
parent1f5b39b749d49214e2383c1333cf8603a1da604e (diff)
downloadrt.equinox.framework-132d809466703c06a758fc86f8ae5ad7cb9f4954.tar.gz
rt.equinox.framework-132d809466703c06a758fc86f8ae5ad7cb9f4954.tar.xz
rt.equinox.framework-132d809466703c06a758fc86f8ae5ad7cb9f4954.zip
Bug 475640 - To open "Eclipse" you need to install the legacy Java SE 6
runtime. Change-Id: I53d06915592283618c2c2b8298f57bb1d659d766 Signed-off-by: Till Brychcy <register.eclipse@brychcy.de>
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoa.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoa.c b/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoa.c
index deba3ef3f..4529c34a7 100644
--- a/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoa.c
+++ b/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoa.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -377,8 +377,12 @@ char * getJavaHome() {
if (fp == NULL) {
return NULL;
}
+ path[0] = 0;
while (fgets(path, sizeof(path)-1, fp) != NULL) {
}
+ if(path[0]==0) {
+ return NULL;
+ }
result = path;
start = strchr(result, '\n');
if (start) {
@@ -421,6 +425,9 @@ char * findVMLibrary( char* command ) {
cmd = command;
if (strstr(cmd, "/JavaVM.framework/") != NULL && (strstr(cmd, "/Current/") != NULL || strstr(cmd, "/A/") != NULL)) {
cmd = getJavaHome();
+ if (cmd == NULL) {
+ return NULL;
+ }
}
// This is necessary to initialize isModularJVM
checkJavaVersion(cmd);
@@ -554,7 +561,15 @@ void restartLauncher(char* program, char* args[]) {
JavaResults* launchJavaVM( _TCHAR* args[] )
{
- /*for now always do JNI on Mac, should not come in here */
+ /*
+ * On macOS, JNI is always used, so this point is only reached, if no usable JVM was found.
+ * Request a JDK install: The 'script' command makes stdin and stdout look like a tty,
+ * so it looks for /usr/libexec/java_home that this is for a command line tool and a dialog
+ * with a link to the JDK download page is shown.
+ */
+ execl("/usr/bin/script", "/usr/bin/script", "/dev/null", "/usr/libexec/java_home", "--request", NULL);
+
+ /* not reached. */
JavaResults * results = malloc(sizeof(JavaResults));
results->launchResult = -1;
results->runResult = 0;