Community
Participate
Working Groups
When running ECJ standalone compiler on Harmony JVMs (both DRLVM and IBM VME binary) from command line as java -jar ecj.jar <java source file> I get an error that java.lang.Object (and other core java classes) cannot be resolved. This happens because Harmony structure of boot class JARs different from Sun. On Sun all boot class JARs are located in java.home/lib directory and so ECJ finds them successfully. On Harmony boot class JARs are located in java.home/lib/boot (and subdirectories) and java.home/bin/default. This layout comes from Harmony modularity. But ECJ fails to find boot class JARs because they are located in java.home/lib subdirectories, and heuristics that works for Sun fails with Harmony. Harmony JVMs provide a property which contains all the JAR files with absolute path names called "org.apache.harmony.boot.class.path". The easiest way to allow ECJ to find boot classes on Harmony would be to make it use this property. BTW on Sun and BEA JVMs it is possible to use sun.boot.library.path instead of searching for JAR files in java.home/lib directory :)
It seems that the property "sun.boot.class.path" is defined for all VMs I tried (Harmony, IBM, Sun, BEA). The property "org.apache.harmony.boot.class.path" doesn't seem to include a jar that contains java.lang.Object. I have a patch ready that is using the property "sun.boot.class.path" for all VMs and it looks like the bootclasspath is properly retrieved now for Harmony as well. Did I miss something as you suggested to use only the property "org.apache.harmony.boot.class.path" ?
Created attachment 68374 [details] Proposed fix I tested it with Harmony(0.5M1), IBM(1.4/1.5/1.6), BEA(27.1) and Sun VM (1.4/1.5/1.6/1.7). It seems to work as expected now.
Kent, please review.
Maxime, please review.
Created attachment 68378 [details] Proposed fix New patch to also check for the property "org.apache.harmony.boot.class.path" in case of run on IBM VME (from the Harmony mailing list).
Olivier, I'd suggest that you cascade the tests as: 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$ } } This would save a couple of tests most times (since we expect to get it right on the sun.boot.class.path call in most cases). Patch still good without this change anyway.
Good suggestion. Released for 3.3RC2
Created attachment 68417 [details] Better patch Patch based on Maxime's suggestion.
I verified that the bug is fixed on the nightly build I20070524-0800. Harmony runs ECJ just fine now.
*** Bug 192576 has been marked as a duplicate of this bug. ***