5.0 RC: does not compile (cannot access java.lang.Object)
I tried to compile my project with JDK 5.0 RC (that works with JDK 1.4.2_05), but it doesn't work:
[javac] cannot access java.lang.Object
[javac] badclass file: C:\Programme\Sun\Java\J2SE\JRE\jre1.5.0rc\lib\rt.jar(java/lang/Object.class)
[javac]class file has wrong version 49.0, should be 48.0
[javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
[javac]staticpublicfinal String FORMAT_DATE ="yyyy-MM-dd";
[javac] ^
[javac] 1 error
Of course, i first adjusted two compilation errors for the new classes Formatter und UUID (that collided with my own classes). I also deleted all class files and did a fresh compile. But it doesn't help.
... however, I'm not able to change back to JDK 1.4 after I installed JDK 5.0. I get the same error now after reverting back to 1.4. I also noticed that in a console, "java -version" always shows the 5.0 version - no matter if my JAVA_HOME is set to 1.4 and this is also in my PATH. I found a "java.exe" file in the C:/WINNT/SYSTEM32 that is from version 5.0.
You must have installed a public JRE aswell when you installed JDK 5.0. The public JRE installs a copy of java.exe and javaw.exe to a system directory so that it's not necessary to set PATH to run java programs.
How have you set up your PATH? You should move the Java SDK directory before the system directories; that way you get your desired version. Also, the version of "javac" may be different than version of "java" can be checked with javac -J-version.
What comes to ANT, I thought you only need to set JAVA_HOME, if you are using ANT through Eclipse it's probably some setting in Eclipse that you have to change...
How is java getting into c:/winnt/system32? And you speak of compiling. Where is your javac?
JAVA_HOME in your PATH doesn't do it but
set PATH=%JAVA_HOME%/bin
will if javac and java are in the jdk bin folder.
Also when you are working with 1.5.x source code you need to set the target to 1.5 or 5 http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javac.html