View | Details | Raw Unified | Return to bug 195509 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/util/Util.java (-38 / +59 lines)
Lines 639-685 Link Here
639
 * Example of use: [org.eclipse.jdt.core.tests.util.Util.getJavaClassLib()]
639
 * Example of use: [org.eclipse.jdt.core.tests.util.Util.getJavaClassLib()]
640
*/
640
*/
641
public static String[] getJavaClassLibs() {
641
public static String[] getJavaClassLibs() {
642
    String jreDir = getJREDirectory();
642
	// check bootclasspath properties for Sun, JRockit and Harmony VMs
643
    final String osName = System.getProperty("os.name");
643
	String bootclasspathProperty = System.getProperty("sun.boot.class.path"); //$NON-NLS-1$
644
    if (jreDir == null) {
644
	if ((bootclasspathProperty == null) || (bootclasspathProperty.length() == 0)) {
645
        return new String[] {};
645
		// IBM J9 VMs
646
    }
646
		bootclasspathProperty = System.getProperty("vm.boot.class.path"); //$NON-NLS-1$
647
    if (osName.startsWith("Mac")) {
647
		if ((bootclasspathProperty == null) || (bootclasspathProperty.length() == 0)) {
648
        return new String[] {
648
			// Harmony using IBM VME
649
            toNativePath(jreDir + "/../Classes/classes.jar")
649
			bootclasspathProperty = System.getProperty("org.apache.harmony.boot.class.path"); //$NON-NLS-1$
650
        };
650
		}
651
    }
651
	}
652
    final String vmName = System.getProperty("java.vm.name");
652
	String[] jars = null;
653
    if ("J9".equals(vmName)) {
653
	if ((bootclasspathProperty != null) && (bootclasspathProperty.length() != 0)) {
654
        return new String[] {
654
		StringTokenizer tokenizer = new StringTokenizer(bootclasspathProperty, File.pathSeparator);
655
            toNativePath(jreDir + "/lib/jclMax/classes.zip")
655
		jars = new String[tokenizer.countTokens()];
656
        };
656
		int i = 0;
657
    }
657
		while (tokenizer.hasMoreTokens()) {
658
	if ("DRLVM".equals(vmName)) {
658
			jars[i] = toNativePath(tokenizer.nextToken());
659
		FilenameFilter jarFilter = new FilenameFilter() {
659
			i++;
660
			public boolean accept(File dir, String name) {
660
		}
661
				return name.endsWith(".jar") & !name.endsWith("-src.jar");
661
	} else {
662
		String jreDir = getJREDirectory();
663
		final String osName = System.getProperty("os.name");
664
		if (jreDir == null) {
665
			return new String[] {};
666
		}
667
		if (osName.startsWith("Mac")) {
668
			return new String[] {
669
					toNativePath(jreDir + "/../Classes/classes.jar")
670
			};
671
		}
672
		final String vmName = System.getProperty("java.vm.name");
673
		if ("J9".equals(vmName)) {
674
			return new String[] {
675
					toNativePath(jreDir + "/lib/jclMax/classes.zip")
676
			};
677
		}
678
		if ("DRLVM".equals(vmName)) {
679
			FilenameFilter jarFilter = new FilenameFilter() {
680
				public boolean accept(File dir, String name) {
681
					return name.endsWith(".jar") & !name.endsWith("-src.jar");
682
				}
683
			};
684
			jars = new File(jreDir + "/lib/boot/").list(jarFilter);
685
			for (int i = 0; i < jars.length; i++) {
686
				jars[i] = toNativePath(jreDir + "/lib/boot/" + jars[i]);
662
			}
687
			}
663
		};
688
		} else {
664
		String[] jars = new File(jreDir + "/lib/boot/").list(jarFilter);
689
			ArrayList paths = new ArrayList();
665
		for (int i = 0; i < jars.length; i++) {
690
			String[] jarsNames = new String[] {
666
			jars[i] = toNativePath(jreDir + "/lib/boot/" + jars[i]);
691
					"/lib/vm.jar",
692
					"/lib/rt.jar",
693
					"/lib/core.jar",
694
					"/lib/security.jar",
695
					"/lib/xml.jar",
696
					"/lib/graphics.jar"
697
			};
698
			addJarEntries(jreDir, jarsNames, paths);
699
			jars = new String[paths.size()];
700
			paths.toArray(jars);
667
		}
701
		}
668
		return jars;
669
	}
702
	}
670
    ArrayList paths = new ArrayList();
703
	return jars;
671
    String[] jarsNames = new String[] {
672
    		"/lib/vm.jar",
673
    		"/lib/rt.jar",
674
    		"/lib/core.jar",
675
    		"/lib/security.jar",
676
    		"/lib/xml.jar",
677
    		"/lib/graphics.jar"
678
    };
679
    addJarEntries(jreDir, jarsNames, paths);
680
    String[] result = new String[paths.size()];
681
    paths.toArray(result);
682
    return result;
683
}
704
}
684
private static void addJarEntries(String jreDir, String[] jarNames, ArrayList paths) {
705
private static void addJarEntries(String jreDir, String[] jarNames, ArrayList paths) {
685
	for (int i = 0, max = jarNames.length; i < max; i++) {
706
	for (int i = 0, max = jarNames.length; i < max; i++) {

Return to bug 195509