Bug 544743 - [12] Eclipse Application launch config uses JavaSE-1.8
instead of JavaSE-12

Change-Id: I869ff05ee0a5f65de60dfd2dc05d7f7bbc8a5438
Signed-off-by: Vikas Chandra <Vikas.Chandra@in.ibm.com>
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/JREBlock.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/JREBlock.java
index 799c8d2..a6072e5 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/JREBlock.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/JREBlock.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2018 IBM Corporation and others.
+ * Copyright (c) 2005, 2019 IBM Corporation and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -200,8 +200,20 @@
 		String vmInstallName = null;
 		String eeId = null;
 		if (jrePath == null) {
+			// Try to get a default EE based on default VM install first
+			IVMInstall install = JavaRuntime.getDefaultVMInstall();
+			IExecutionEnvironment[] systemEnvs = JavaRuntime.getExecutionEnvironmentsManager()
+					.getExecutionEnvironments();
+			for (IExecutionEnvironment iExecutionEnvironment : systemEnvs) {
+				if (iExecutionEnvironment.isStrictlyCompatible(install)) {
+					eeId = iExecutionEnvironment.getId();
+					break;
+				}
+			}
 			// Try to get a default EE based on the selected plug-ins in the config
-			eeId = VMHelper.getDefaultEEName(config);
+			if (eeId == null) {
+				eeId = VMHelper.getDefaultEEName(config);
+			}
 			if (eeId == null) {
 				vmInstallName = VMHelper.getDefaultVMInstallName(config);
 			}