1 11 package org.eclipse.jdt.internal.launching; 12 13 14 import java.io.File ; 15 16 import org.eclipse.debug.core.ILaunchManager; 17 import org.eclipse.jdt.launching.AbstractVMInstall; 18 import org.eclipse.jdt.launching.IVMInstallType; 19 import org.eclipse.jdt.launching.IVMRunner; 20 21 public class StandardVM extends AbstractVMInstall { 22 StandardVM(IVMInstallType type, String id) { 23 super(type, id); 24 } 25 28 public IVMRunner getVMRunner(String mode) { 29 if (ILaunchManager.RUN_MODE.equals(mode)) { 30 return new StandardVMRunner(this); 31 } else if (ILaunchManager.DEBUG_MODE.equals(mode)) { 32 return new StandardVMDebugger(this); 33 } 34 return null; 35 } 36 37 40 public String getJavaVersion() { 41 StandardVMType installType = (StandardVMType) getVMInstallType(); 42 File installLocation = getInstallLocation(); 43 if (installLocation != null) { 44 File executable = StandardVMType.findJavaExecutable(installLocation); 45 if (executable != null) { 46 String vmVersion = installType.getVMVersion(installLocation, executable); 47 StringBuffer version = new StringBuffer (); 49 for (int i = 0; i < vmVersion.length(); i++) { 50 char ch = vmVersion.charAt(i); 51 if (Character.isDigit(ch) || ch == '.') { 52 version.append(ch); 53 } else { 54 break; 55 } 56 } 57 if (version.length() > 0) { 58 return version.toString(); 59 } 60 } 61 } 62 return null; 63 } 64 } 65 | Popular Tags |