Hi all,I just installed Jdk 1.6 update 4 and tried my first compilation. Icompiled something that previously compiled easily. However, with Jdk1.6 I got the error:SomeFile.java:45: cannot access java.lang.Objectbad class file: C:\Tools\Jdk16\jre\lib\rt.jar(java/lang/Object.class)class file has wrong version 49.0, should be 48.0Please remove or make sure it appears in the correct subdirectory ofthe classpath. private UserRec currRec = null;I compile directly with javac from a DOS prompt. I tried to compilefew other files and got the same results.Please help!
|
|
0
|
|
|
|
Reply
|
rzeira
|
1/17/2008 3:14:20 PM |
|
rzeira@comcast.net wrote:> I just installed Jdk 1.6 update 4 and tried my first compilation. I> compiled something that previously compiled easily. However, with Jdk> 1.6 I got the error:> SomeFile.java:45: cannot access java.lang.Object> bad class file: C:\Tools\Jdk16\jre\lib\rt.jar(java/lang/Object.class)> class file has wrong version 49.0, should be 48.0Hi,typical problem for window$ users - curse of PATH env. var. :)Your OS runs old javac; correct your PATH env. var. manually or invoke javac with full path.And better switch your OS to something normal, Linux-based, like Mepis.-- Regards,Jonatan KazmierczakSCJP SCJD TC_rated_memberAsm86 Bash C/C++ Java JavaScript Pascal Perl PHP Ruby TCL VB VBScript
|
|
0
|
|
|
|
Reply
|
Jonatan
|
1/17/2008 5:07:57 PM
|
|
On Thu, 17 Jan 2008 07:14:20 -0800 (PST), rzeira@comcast.net wrote,quoted or indirectly quoted someone who said :>SomeFile.java:45: cannot access java.lang.ObjectFor a brute force fix, uninstall all JREs and JDKs. Manually pruneany left over directories. then reinstall just one JDK from scratch.Note JDK 1.6.0_04 just came out so you might as well use that.Check any set parms for outdated references.-- Roedy Green, Canadian Mind ProductsThe Java Glossary, http://mindprod.com
|
|
0
|
|
|
|
Reply
|
Roedy
|
1/17/2008 5:59:07 PM
|
|
On Thu, 17 Jan 2008 07:14:20 -0800 (PST), rzeira@comcast.net wrote,
quoted or indirectly quoted someone who said :
>I just installed Jdk 1.6 update 4 and tried my first compilatio
see http://mindprod.com/jgloss/jdk.html#UPGRADING
--
Roedy Green, Canadian Mind Products
The Java Glossary, http://mindprod.com
|
|
0
|
|
|
|
Reply
|
Roedy
|
1/17/2008 6:17:27 PM
|
|
(multi-post unified)
rzeira@comcast.net wrote:
>>> I just installed Jdk 1.6 update 4 and tried my first compilation. I
>>> compiled something that previously compiled easily. However, with Jdk
>>> 1.6 I got the error:
>>> SomeFile.java:45: cannot access java.lang.Object
>>> bad class file: C:\Tools\Jdk16\jre\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.
>>> private UserRec currRec = null;
>>>
>>> I compile directly with javac from a DOS prompt. I tried to compile
>>> few other files and got the same results.
>>>
>>> Please help!
As Juha Laiho said,
>> Looks much like the "javac" executable you're running is from some
>> older JDK version. Check each directory on your %PATH% to find out
>> which javac you're actually running.
rzeira@comcast.net replied:
> However, I have only one javac.exe which came with JDK 1.6.0_04 and is
> dated December 14, 2007. I think this version is defective. Does
> anybody knows how to get one that is fixed?
Unfortunately, Juha must be correct. There is another javac in your path and
it's not able to read the current classfile format (version 49.0). That means
that it's a compiler from an earlier version than Java 6, let alone update 4.
In fact, it looks like class file version 48.0 is from JDK 1.4. So there is a
version 1.4 of the JDK trying to read the Java 6 libraries and choking.
It seems that this is a FAQ going back to 2004 at least.
<http://forum.java.sun.com/thread.jspa?threadID=517933&tstart=0>
Pop "Java class file version 49.0" into your favorite search engine and see
what you find - probably more like that page that showed up in my search.
<http://java.sun.com/javase/6/docs/technotes/guides/vm/enhancements.html>
> The J2SE 1.4.0 platform accepts class file versions in the range 45.3 to 48.0.
<http://en.wikipedia.org/wiki/Class_(file_format)>
> major version number of the class file format being used.
> J2SE 6.0=50, J2SE 5.0=49, JDK 1.4=48, JDK 1.3=47, JDK 1.2=46.
--
Lew
|
|
0
|
|
|
|
Reply
|
Lew
|
1/17/2008 6:35:47 PM
|
|
|
4 Replies
663 Views
(page loaded in 0.098 seconds)
Similiar Articles: Jdk 1.6 will not compile: cannot access java.lang.Object - comp ...Hi all,I just installed Jdk 1.6 update 4 and tried my first compilation. Icompiled something that previously compiled easily. However, with Jdk1.6 I g... cannot access mcc daq USB-1298FS with matlab 2010a - comp.soft-sys ...Jdk 1.6 will not compile: cannot access java.lang.Object - comp ... cannot access mcc daq USB-1298FS with matlab 2010a - comp.soft-sys ... Jdk 1.6 will not compile: cannot ... Java Update Error - comp.lang.java.helpJdk 1.6 will not compile: cannot access java.lang.Object - comp ... Java Update Error - comp.lang.java.help How do I install Java?? I had JDK 6 Update 17 and it was working ... How to determine Java version is at least 6? - comp.lang.java ...Jdk 1.6 will not compile: cannot access java.lang.Object - comp ... Jdk 1.6 will not compile: cannot access java.lang.Object - comp ... How to determine Java version is at ... JRE1.6 - comp.lang.java.programmerJRE1.6 - comp.lang.java.programmer Jdk 1.6 will not compile: cannot access java.lang.Object - comp ... Hi all ... I've got the same problem. My java version is 6 Update ... Javascript search engine - comp.lang.javascriptJdk 1.6 will not compile: cannot access java.lang.Object - comp ... Javascript search engine - comp.lang.javascript Jdk 1.6 will not compile: cannot access java.lang ... Error Compiling Ruby - comp.lang.rubyJdk 1.6 will not compile: cannot access java.lang.Object - comp ... However, with Jdk> 1.6 I got the error:> SomeFile.java ... Bash C/C++ Java JavaScript Pascal Perl PHP ... accessing window.top.location - comp.lang.javascript... I'm running this file: jdk-6u24-windows-i586.exe (Size ... If you install the JRE in the same location as the old ... Jdk 1.6 will not compile: cannot access java.lang ... class file has wrong version 49.0, should be 48.0 - comp.lang.java ...> I cannot change jdk but use 1.4 ( sniff ... one first: 1. Compile with jdk 1.5, but use the switch "-target 1.4" http://java ... 48.0 - comp.lang.java ... upgrade to JDK 1.6 ... how do I check for existance of env var in bash - comp.unix ...Jdk 1.6 will not compile: cannot access java.lang.Object - comp ...:)Your OS runs old javac; correct your PATH env. var ... 0_04 just came out so you might as well use ... Jdk 1.6 will not compile: cannot access java.lang.Object - comp ...Hi all,I just installed Jdk 1.6 update 4 and tried my first compilation. Icompiled something that previously compiled easily. However, with Jdk1.6 I g... Jdk 1.6 will not compile: cannot access java.lang.ObjectOn Thu, 17 Jan 2008 07:14:20 -0800 (PST), wrote, quoted or indirectly quoted someone who said : >SomeFile.java:45: cannot access java.lang.Object 7/24/2012 12:16:27 AM
|