1 11 package org.eclipse.pde.internal.core.exports; 12 13 import org.eclipse.jdt.launching.IVMInstall; 14 import org.eclipse.jdt.launching.JavaRuntime; 15 import org.eclipse.jdt.launching.LibraryLocation; 16 import org.eclipse.jdt.launching.environments.IExecutionEnvironment; 17 import org.eclipse.jdt.launching.environments.IExecutionEnvironmentsManager; 18 19 public class BuildUtilities { 20 21 public static String getBootClasspath() { 22 return getBootClasspath(JavaRuntime.getDefaultVMInstall()); 23 } 24 25 public static String getBootClasspath(String environmentID) { 26 IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager(); 27 IExecutionEnvironment environment = manager.getEnvironment(environmentID); 28 IVMInstall vm = null; 29 if (environment != null) { 30 vm = environment.getDefaultVM(); 31 if (vm == null) { 32 IVMInstall[] installs = environment.getCompatibleVMs(); 33 for (int i = 0; i < installs.length; i++) { 35 IVMInstall install = installs[i]; 36 if (environment.isStrictlyCompatible(install)) { 37 vm = install; 38 break; 39 } 40 } 41 if (vm == null && installs.length > 0) { 43 vm = installs[0]; 44 } 45 } 46 } 47 if (vm == null) 48 vm = JavaRuntime.getDefaultVMInstall(); 49 return getBootClasspath(vm); 50 } 51 52 public static String getBootClasspath(IVMInstall install) { 53 StringBuffer buffer = new StringBuffer (); 54 LibraryLocation[] locations = JavaRuntime.getLibraryLocations(install); 55 for (int i = 0; i < locations.length; i++) { 56 buffer.append(locations[i].getSystemLibraryPath().toOSString()); 57 if (i < locations.length - 1) 58 buffer.append(";"); } 60 return buffer.toString(); 61 } 62 63 } 64 | Popular Tags |