sree032397
asked on
rt.jar Version Mismatch
Hi,
I was using jdk 1.4.2. Today I uninstalled it and installed jdk 1.6. Again I uninstalled JDK 1.6 and now I installed jdk1.5 with netbeans.
I am using ant script for building. whenevr i tried to build using ant it is giving an error like this(Previously in jdk 1.4 it same code was working fine.)
C:\san>ant
Buildfile: build.xml
clean:
[delete] Deleting directory C:\san\classes
init:
[mkdir] Created dir: C:\san\classes
[mkdir] Created dir: C:\san\classes\res
comp:
[javac] Compiling 34 source files to C:\Geneva CRM\classes
[javac] C:\san\src\gstl\san\Main.j ava:16: cannot access javax.swing.
JFrame
[javac] bad class file: C:\jdk1.5.0_07\jre\lib\rt. jar(javax/ swing/JFra me.cla
ss)
[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] public class Main extends JFrame implements ActionListener,WindowLis
tener
[javac] ^
[javac] 1 error
BUILD FAILED
C:\san\build.xml:32: Compile failed; see the compiler error output for de
tails.
Total time: 2 seconds
I am not getting what the error is. Can any body help me as soon as possible. I am doing an important project work now.
I was using jdk 1.4.2. Today I uninstalled it and installed jdk 1.6. Again I uninstalled JDK 1.6 and now I installed jdk1.5 with netbeans.
I am using ant script for building. whenevr i tried to build using ant it is giving an error like this(Previously in jdk 1.4 it same code was working fine.)
C:\san>ant
Buildfile: build.xml
clean:
[delete] Deleting directory C:\san\classes
init:
[mkdir] Created dir: C:\san\classes
[mkdir] Created dir: C:\san\classes\res
comp:
[javac] Compiling 34 source files to C:\Geneva CRM\classes
[javac] C:\san\src\gstl\san\Main.j
JFrame
[javac] bad class file: C:\jdk1.5.0_07\jre\lib\rt.
ss)
[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] public class Main extends JFrame implements ActionListener,WindowLis
tener
[javac] ^
[javac] 1 error
BUILD FAILED
C:\san\build.xml:32: Compile failed; see the compiler error output for de
tails.
Total time: 2 seconds
I am not getting what the error is. Can any body help me as soon as possible. I am doing an important project work now.
Check your JaAVA_HOME and if you still have jdk1.4. 48 means jdk1.4 while 49 means 1.5. for some reason it is still looking to jdk1.4
ASKER
Yes I have checked for that. My JAVA_HOME refers to jdk 1.5
ok can you do a java -version and see what it returns?
Put
%JAVA_HOME%\bin
as the first entry in your PATH variable
%JAVA_HOME%\bin
as the first entry in your PATH variable
ASKER
java -version returns 1.5
What does
javac
print?
javac
print?
And just for the record, what does
echo %JAVA_HOME%
print?
echo %JAVA_HOME%
print?
ASKER
Both java and javac are refering to jdk 1.5
sounds like you may not have uninstalled them. have you checked that they were removed completely?
Somehow Ant tries to find 1.4 libs. Which version os Ant are you using? Do you have the one coming with NetBeans?
Try
ant -Dbuild.compiler=javac1.5
ant -Dbuild.compiler=javac1.5
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>> Just delete all java.exe and javaw.exe from your windows directory (and subdirectories).
Might not solve the problem. Have you tried CEHJ's (%JAVA_HOME%\bin at the start of PATH).
Might not solve the problem. Have you tried CEHJ's (%JAVA_HOME%\bin at the start of PATH).
Just for the sake of completeness - also check the current version in your Windows registry HKEY_LOCAL_MACHINE\SOFTWAR E\JavaSoft \Java Runtime Environment
Sledge-hammer solution :) you still need to learn how to manage different JREs installed on your machine. Deleting the others is not the right way of learning this.