Solved

rt.jar Version Mismatch

Posted on 2006-07-19
15
681 Views
Last Modified: 2013-11-23
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.java:16: cannot access javax.swing.
JFrame
    [javac] bad class file: C:\jdk1.5.0_07\jre\lib\rt.jar(javax/swing/JFrame.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.
0
Comment
Question by:sree032397
  • 4
  • 3
  • 3
  • +3
15 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 17136988
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
0
 
LVL 1

Author Comment

by:sree032397
ID: 17137008
Yes I have checked for that. My JAVA_HOME refers to jdk 1.5
0
 
LVL 35

Expert Comment

by:girionis
ID: 17137024
ok can you do a java -version and see what it returns?
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 86

Expert Comment

by:CEHJ
ID: 17137032
Put

%JAVA_HOME%\bin

as the first entry in your PATH variable
0
 
LVL 1

Author Comment

by:sree032397
ID: 17137054
java -version returns 1.5
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17137098
What does

javac

print?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17137106
And just for the record, what does

echo %JAVA_HOME%

print?
0
 
LVL 1

Author Comment

by:sree032397
ID: 17137110
Both java and javac are refering to jdk 1.5
0
 
LVL 92

Expert Comment

by:objects
ID: 17137129
sounds like you may not have uninstalled them. have you checked that they were removed completely?
0
 
LVL 35

Expert Comment

by:girionis
ID: 17137131
Somehow Ant tries to find 1.4 libs. Which version os Ant are you using? Do you have the one coming with NetBeans?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17137150
Try

ant -Dbuild.compiler=javac1.5
0
 
LVL 12

Accepted Solution

by:
enachemc earned 500 total points
ID: 17137342
Just delete all java.exe and javaw.exe from your windows directory (and subdirectories).
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 17137903
>> 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).
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 17138658
Just for the sake of completeness - also check the current version in your Windows registry HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 17200316
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.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MySqlDump not dumping triggers 1 43
Tomcat: Unable to run tomcat service. 2 23
jsp login check 12 42
Need Help! Getting a syntax error and don't understand why 3 31
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question