Bug 145835 - getJavaClassLibs needs to account for IBM J2SE 1.5
Summary: getJavaClassLibs needs to account for IBM J2SE 1.5
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.2.1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-07 14:38 EDT by Corey Ashford CLA
Modified: 2006-09-12 02:48 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Corey Ashford CLA 2006-06-07 14:38:39 EDT
+++ This bug was initially created as a clone of Bug #40584 +++

Inside the JDT/Core test suites, the libraries are retrieved using the
org.eclipse.jdt.core.tests.util.Util class. In this class, we assume that rt.jar
or classes.zip can be retrieved. The name of VMs are hard-coded.
Customers experiment some trouble to run the test suites because
java.lang.Object cannot be found.

The method:
/**
 * Search the user hard-drive for a Java class library.
 * Returns null if none could be found.
 *
 * Example of use: [org.eclipse.jdt.core.tests.util.Util.getJavaClassLib()]
*/
public static String getJavaClassLibs() {
...
}
should be improved.

+++++++++++++++++++

Specifically, I am now seeing a problem with the IBM Java2 version 1.5 where they have moved java.lang.Object from core.jar to vm.jar.  This is causing tests to fail because getJavaClassLibs does not know about vm.jar.

For reference, here's the output of "java -version"

java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build pxp32devifx-20060310 (SR1))
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Linux ppc-32 j9vmxp3223ifx-20060310 (JIT enabled)
J9VM - 20060220_05389_bHdSMR
JIT  - 20060220_2133_r8
GC   - 20060214_AA)
JCL  - 20060222a

I should note that the same problem occurs for x86 variant as well.

In my workspace, I have modified getJavaClassLibs as follows:

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")};
		 }
		 File file = new File(jreDir + "/lib/rt.jar");
		 if (file.exists()) {
		 		 return new String[] {
		 		 		 toNativePath(jreDir + "/lib/rt.jar")
		 		 };		 		 		 		 
		 }
		 file = new File(jreDir + "/lib/vm.jar");
		 if (file.exists()) {
		     // The IBM J2SE 5.0 has put the java.lang classes in vm.jar.
		     return new String[] {
		 	toNativePath(jreDir + "/lib/vm.jar"),
		 	toNativePath(jreDir + "/lib/core.jar"),
		 	toNativePath(jreDir + "/lib/security.jar"),
		        toNativePath(jreDir + "/lib/graphics.jar")
		 		 		 };
		 }
		 return new String[] { 
		 		 toNativePath(jreDir + "/lib/core.jar"),
		 		 toNativePath(jreDir + "/lib/security.jar"),
		 		 toNativePath(jreDir + "/lib/graphics.jar")
		 };
}
Comment 1 Philipe Mulet CLA 2006-06-08 03:18:19 EDT
Corey - ok to wait until 3.2.1 ?
Comment 2 Corey Ashford CLA 2006-06-08 12:03:52 EDT
Yes, I think 3.2.1 is ok since this affects only people who run the test suite using the IBM JRE.

Comment 3 Jerome Lanneluc CLA 2006-06-16 09:04:01 EDT
Thanks for the patch.
Released for 3.3M1 in HEAD.
Releasef for 3.2.1 in TARGET_321 branch.
Comment 4 Frederic Fusier CLA 2006-08-07 06:50:46 EDT
Verified for 3.3 M1 using build I20060807-0010.
Comment 5 Frederic Fusier CLA 2006-09-06 05:11:54 EDT
Released for 3.2.1
Comment 6 Maxime Daniel CLA 2006-09-12 02:48:13 EDT
Verified for 3.2.1 using build M20060908-1655 (R3_2_maintenance source code indeed).