Hi -- I just downloaded the 1.5 SDK, and I am unable to compile any
of my code (which was compiling fine in 1.4).
This is the error I get:
bad class file: C:\pkgs\j2sdk1.5.0\jre\lib\rt.jar(java/
class file has wrong version 49.0, should be 48.0
I've tried different -source and -target options with no luck.
It's like I have a bad rt.jar file or something, but I've tried it on
different machines with the same result. I assume I'm missing
something obvious... please fill me in, thanks!
bad class file:
C:\pkgs\j2sdk1.5.0\jre\lib\rt.jar(java/
class file has wrong version 49.0, should be 48.0
Check to see which javac and java you're running. (Check your PATH, and see which java and javac are being picked up). This looks like you're using a JDK 1.5 library, with a JDK 1.4 VM.
Re: 1.5: class file has wrong version 49.0, should be 48.0
Feb 3, 2005 7:25 AM
(reply 6
of 64) (In reply to
#5 )
49 is the correct classfile version for 1.5.
If you're getting this error your runtime is 1.4 or earlier while your compiler is 1.5.
Nothing wrong with the JDK, only with your system configuration.
Most likely you have old java and javaw exes somewhere on your path which can get loaded in preference to the ones in your JDK installation.
Re: 1.5: class file has wrong version 49.0, should be 48.0
Feb 5, 2005 7:53 PM
(reply 7
of 64) (In reply to
#6 )
I'm having this exact same problem but I'm not too sure on how to fix it. I've tried following the replies but I'm just even more confused.
What I sort of understand is the runtine and compiler both has to be set to 1.5. But the runtime is in 1.4 right? How can I fix this so I have both to 1.5.
I just recently uninstalled and reinstalled 5 Java environments in my computer which is probably why I'm so frustrated with this. Please let me know which one I dont need if there is any.
They are:
J2SE DEvelopment Kit 5.0 Update 1
J2SE Runtime environment 5.0 Update 1
Java 2 Platform Enterprise Edition 1.4 SDK
Java 2 Runtime Environment SE 1.4.2_07
Java 2 SDK SE 1.4.2_07
Re: 1.5: class file has wrong version 49.0, should be 48.0
Feb 5, 2005 9:00 PM
(reply 8
of 64) (In reply to
#7 )
Background information:
Java 1.4 creates class files labeled with version 48.0
Java 1.5 creates class files labeled with version 49.0
Java 1.4 can't run class files labeled with version 49.0
If you are getting the error, that means that you're trying to run using Java 1.4 - either you're doing it, ir (more likely) your PATH environment variable is set so that Java 1.4 is before 1.5 in the path, and it executes rather than 1.5
Solution: change (something!) so that 1.5 runs class files labeled 49.0.
Unless you need multiple Java versions, you can delete all except the two 5.0 entries.
Re: 1.5: class file has wrong version 49.0, should be 48.0
Feb 16, 2005 6:25 AM
(reply 9
of 64) (In reply to
#5 )
Could you please explain exactly you changed which libs were referenced by your Ant configuration in Eclipse? I have tried, in Eclipse 3.0, Window > Preferences > Ant > Runtime > Classpath > Global Entries -- in which I added the path to my Java 1.5 tools.jar file, but to no avail. Ant still tells me, upon trying to run javac, "class file has wrong version 49.0, should be 48.0".
Re: 1.5: class file has wrong version 49.0, should be 48.0
Feb 16, 2005 8:03 AM
(reply 10
of 64) (In reply to
#9 )
Gregers:
Check the value of your JAVA_HOME environment variable and make sure that this doesn't point to a 1.4 installation. After you've changed it, restart Eclipse so that it picks up the new value of the variable.
Re: 1.5: class file has wrong version 49.0, should be 48.0
Mar 10, 2005 1:08 AM
(reply 11
of 64) (In reply to
#10 )
i am facing the same problem
i am trying to use struts
my other jsp file were get compiled properly but
when i used struts taglibs to create a jsp file i got the error
class file has wrong version 49.0, should be 48.0
i checked JAVA_HOME variable and class path
they are pointing to jdk 1.5 only *******************
error as displayed by tomcat
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: -1 in the jsp file: null
D:\Program Files\Apache Software Foundation\Tomcat 5.5\work\Catalina\localhost\strutsProject\org\apache\jsp\userRegistration_jsp.java:7: cannot access java.lang.Object
bad class file: D:\Program Files\Java\jre1.5.0_01\lib\rt.jar(java/lang/Object.class)
class file has wrong version 49.0, should be 48.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
public final class userRegistration_jsp extends org.apache.jasper.runtime.HttpJspBase
^
1 error
Re: 1.5: class file has wrong version 49.0, should be 48.0
Mar 10, 2005 6:34 AM
(reply 12
of 64) (In reply to
#11 )
You need to hack the 1.5 runtime into Tomcat as it comes with the 1.4 runtime as distributed.
It's not hard, just find tools.jar in your Tomcat installationand replace that with the copy from your JDK installation and you're in business.
Problem with old version of tool.jar on Application Servers.
Application Server with Autodeploy use tool.jar to access javac, so if you update
your JDK and your JRE and your System path, but you dont update your tool.jar copy in your Application Server, you wil have this problem because an old javac cant exe new class files.
Alfonso
This topic has
64
replies
on
5
pages.
1
|
2
|
3
|
4
|
5
|
Next »