[153373] Tomcat doesn't support workspace default JRE correctly
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/GenericRuntime.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/GenericRuntime.java
index 3a365ff..d041b18 100644
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/GenericRuntime.java
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/GenericRuntime.java
@@ -89,14 +89,6 @@
 	}
 
 	/**
-	 * @see RuntimeDelegate#setDefaults(IProgressMonitor)
-	 */
-	public void setDefaults(IProgressMonitor monitor) {
-		IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall();
-		setVMInstall(vmInstall.getVMInstallType().getId(), vmInstall.getId());
-	}
-
-	/**
 	 * @see IGenericRuntimeWorkingCopy#setVMInstall(IVMInstall)
 	 */
 	public void setVMInstall(IVMInstall vmInstall) {
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeBridge.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeBridge.java
index 2118e60..998c21a 100644
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeBridge.java
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeBridge.java
@@ -11,6 +11,7 @@
  ******************************************************************************/
 package org.eclipse.jst.server.core.internal;
 
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -177,20 +178,17 @@
 					rcv = RuntimeManager.getRuntimeComponentType("standard.jre").getVersion("6.0");
 				}
 				
-				if (vmInstall != null) {
-					properties = new HashMap(3);
+				properties = new HashMap(3);
+				if (vmInstallName != null)
 					properties.put("name", vmInstallName);
-					IPath path = new Path(JavaRuntime.JRE_CONTAINER);
-					path = path.append(vmInstall.getVMInstallType().getId()).append(vmInstallName);
-					properties.put(CLASSPATH, path.toPortableString());
-					components.add(RuntimeManager.createRuntimeComponent(rcv, properties));
-				} else {
-					properties = new HashMap(3);
+				else
 					properties.put("name", "-");
-					IPath path = new Path(JavaRuntime.JRE_CONTAINER);
-					properties.put(CLASSPATH, path.toPortableString());
-					components.add(RuntimeManager.createRuntimeComponent(rcv, properties));
-				}
+				
+				if (vmInstall == null || isUsingDefaultJRE(javaRuntime))
+					properties.put(CLASSPATH, new Path(JavaRuntime.JRE_CONTAINER).toPortableString());
+				else
+					properties.put(CLASSPATH, JavaRuntime.newJREContainerPath(vmInstall).toPortableString());
+				components.add(RuntimeManager.createRuntimeComponent(rcv, properties));
 			}
 			
 			return components;
@@ -202,4 +200,16 @@
 			return Collections.singletonMap("id", runtime.getId());
 		}
 	}
+
+	protected static boolean isUsingDefaultJRE(IJavaRuntime javaRuntime) {
+		try {
+			Method m = javaRuntime.getClass().getMethod("isUsingDefaultJRE", null);
+			Object o = m.invoke(javaRuntime, null);
+			Boolean b = (Boolean) o;
+			return b.booleanValue();
+		} catch (Throwable t) {
+			// ignore - method not found
+		}
+		return false;
+	}
 }
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntime.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntime.java
index b6d04b6..f6f5ba8 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntime.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntime.java
@@ -152,9 +152,6 @@
 	 * @see RuntimeDelegate#setDefaults(IProgressMonitor)
 	 */
 	public void setDefaults(IProgressMonitor monitor) {
-		IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall();
-		setVMInstall(vmInstall.getVMInstallType().getId(), vmInstall.getId());
-		
 		IRuntimeType type = getRuntimeWorkingCopy().getRuntimeType();
 		getRuntimeWorkingCopy().setLocation(new Path(TomcatPlugin.getPreference("location" + type.getId())));
 	}