### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/util/Util.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java,v retrieving revision 1.56 diff -u -r1.56 Util.java --- src/org/eclipse/jdt/core/tests/util/Util.java 24 May 2007 14:31:35 -0000 1.56 +++ src/org/eclipse/jdt/core/tests/util/Util.java 5 Jul 2007 14:06:10 -0000 @@ -639,47 +639,68 @@ * Example of use: [org.eclipse.jdt.core.tests.util.Util.getJavaClassLib()] */ public static String[] getJavaClassLibs() { - String jreDir = getJREDirectory(); - final String osName = System.getProperty("os.name"); - if (jreDir == null) { - return new String[] {}; - } - if (osName.startsWith("Mac")) { - return new String[] { - toNativePath(jreDir + "/../Classes/classes.jar") - }; - } - final String vmName = System.getProperty("java.vm.name"); - if ("J9".equals(vmName)) { - return new String[] { - toNativePath(jreDir + "/lib/jclMax/classes.zip") - }; - } - if ("DRLVM".equals(vmName)) { - FilenameFilter jarFilter = new FilenameFilter() { - public boolean accept(File dir, String name) { - return name.endsWith(".jar") & !name.endsWith("-src.jar"); + // check bootclasspath properties for Sun, JRockit and Harmony VMs + String bootclasspathProperty = System.getProperty("sun.boot.class.path"); //$NON-NLS-1$ + if ((bootclasspathProperty == null) || (bootclasspathProperty.length() == 0)) { + // IBM J9 VMs + bootclasspathProperty = System.getProperty("vm.boot.class.path"); //$NON-NLS-1$ + if ((bootclasspathProperty == null) || (bootclasspathProperty.length() == 0)) { + // Harmony using IBM VME + bootclasspathProperty = System.getProperty("org.apache.harmony.boot.class.path"); //$NON-NLS-1$ + } + } + String[] jars = null; + if ((bootclasspathProperty != null) && (bootclasspathProperty.length() != 0)) { + StringTokenizer tokenizer = new StringTokenizer(bootclasspathProperty, File.pathSeparator); + jars = new String[tokenizer.countTokens()]; + int i = 0; + while (tokenizer.hasMoreTokens()) { + jars[i] = toNativePath(tokenizer.nextToken()); + i++; + } + } else { + String jreDir = getJREDirectory(); + final String osName = System.getProperty("os.name"); + if (jreDir == null) { + return new String[] {}; + } + if (osName.startsWith("Mac")) { + return new String[] { + toNativePath(jreDir + "/../Classes/classes.jar") + }; + } + final String vmName = System.getProperty("java.vm.name"); + if ("J9".equals(vmName)) { + return new String[] { + toNativePath(jreDir + "/lib/jclMax/classes.zip") + }; + } + if ("DRLVM".equals(vmName)) { + FilenameFilter jarFilter = new FilenameFilter() { + public boolean accept(File dir, String name) { + return name.endsWith(".jar") & !name.endsWith("-src.jar"); + } + }; + jars = new File(jreDir + "/lib/boot/").list(jarFilter); + for (int i = 0; i < jars.length; i++) { + jars[i] = toNativePath(jreDir + "/lib/boot/" + jars[i]); } - }; - String[] jars = new File(jreDir + "/lib/boot/").list(jarFilter); - for (int i = 0; i < jars.length; i++) { - jars[i] = toNativePath(jreDir + "/lib/boot/" + jars[i]); + } else { + ArrayList paths = new ArrayList(); + String[] jarsNames = new String[] { + "/lib/vm.jar", + "/lib/rt.jar", + "/lib/core.jar", + "/lib/security.jar", + "/lib/xml.jar", + "/lib/graphics.jar" + }; + addJarEntries(jreDir, jarsNames, paths); + jars = new String[paths.size()]; + paths.toArray(jars); } - return jars; } - ArrayList paths = new ArrayList(); - String[] jarsNames = new String[] { - "/lib/vm.jar", - "/lib/rt.jar", - "/lib/core.jar", - "/lib/security.jar", - "/lib/xml.jar", - "/lib/graphics.jar" - }; - addJarEntries(jreDir, jarsNames, paths); - String[] result = new String[paths.size()]; - paths.toArray(result); - return result; + return jars; } private static void addJarEntries(String jreDir, String[] jarNames, ArrayList paths) { for (int i = 0, max = jarNames.length; i < max; i++) {