Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Softwaretools > Re: Jdk 1.6 wil...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 3155 of 3221
Post > Topic >>

Re: Jdk 1.6 will not compile: cannot access java.lang.Object

by Lew <lew@[EMAIL PROTECTED] > Jan 17, 2008 at 01:35 PM

(multi-post unified)

rzeira@[EMAIL PROTECTED]
 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@[EMAIL PROTECTED]
 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
 




 1 Posts in Topic:
Re: Jdk 1.6 will not compile: cannot access java.lang.Object
Lew <lew@[EMAIL PROTEC  2008-01-17 13:35:47 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 9 7:30:07 CDT 2008.