Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 88843

Summary: "Incompatible .class files version in required binaries. Project is targeting a 1.4 runtime, but is compiled against '$JAVA_HOME/jre/lib/ext/charset.jar' which requires a 1.5 runtime" and "Cannot find the class file for java.lang.Object"
Product: [Eclipse Project] JDT Reporter: Ralf Hauser <hauser>
Component: DebugAssignee: JDT-Debug-Inbox <jdt-debug-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 CC: philippe_mulet
Version: 3.0.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Ralf Hauser CLA 2005-03-23 08:36:30 EST
recently, I added a few more classes to my source tree and some jar files to the
class-path.

Now, I am getting the above error message for the following jars:
dnsns.jar, localedata.jar, sunpkcs11.jar, jsse.jar, rt.jar 
all of which I did not explicitly include in the class-path, but they all come
from jre/lib/*.

Provide a way how to determine where these dependecies are created such that one
can remove them!

see also: Bug 82733 and Bug 80243
Comment 1 Ralf Hauser CLA 2005-03-23 09:34:56 EST
even when I put my JAVA_HOME back to jdk1.4 when starting eclipse, I still get
<<Incompatible .class files version in required binaries. Project 'p' is
targeting a 1.4 runtime, but is compiled against 'C:Program
Files/Java/jdk1.5.0/jre/lib/charsets.jar' which requires a 1.5 runtime>>
This happens despite the windows-preferences-java-installed_jres has the
1.4.02_05 checked. So, only removing the unchecked 1.5 JRE   !!AND!! restarting
eclipse again got the errors away from the Problems list.

Now, I get <<The project was not built since its build path is incomplete.
Cannot find the class file for java.lang.Object. Fix the build path then try
building this project>> - similar but not exactly like Bug 67414

P.S.: I had 1.5 working nicely for weeks until I ran into this obscure dependency
Comment 2 Dirk Baeumer CLA 2005-03-23 09:49:06 EST
Philippe, can you shed some light on this.
Comment 3 Ralf Hauser CLA 2005-03-23 10:45:25 EST
And I also get back the errors that refer to the 1.5 jre.
Also, setting the machine's Windows Environment variable back to 1.4 doesn't fix
it - it still remembers the 1.5 paths... despite doing Project-Clean with "start
rebuild immediately" checked. 
In the Project's build-path, there was an "unbound" JRE System Library. Removing
it and re-adding the 1.4 one did solve the charset.jar related 1.5 error
messages, but did not fix the missing java.lang.Object

figured out that java.lang.Object.class is in rt.jar.
in windows-preferences-java-build_path-classpath_variables there is a 
JRE_LIB (reserved) pointing to the rt.jar, but this apparently had no effect.

When finally adding the rt.jar manually to the project-property-Java_Build_Path
again, I got it to compile again... (But I guess this is a dirty fix not in the
intention of the eclipse architects)

P.S.: One good way to test for where the mistaken references to the wrong jre
are is to use window-preferences and there press the export button. Opening the
created preferences.epf file as text and searching it gives a lot of insight...
Comment 4 Philipe Mulet CLA 2005-03-23 16:26:57 EST
As you probably figured, this warning is configurable (see
Preferences>Java>Compiler>Building>Incompatible required binaries).

Its intent is to flag cases where you compile code with a certain VM target
(here 1.4) but required some binaries on the classpath which would require a
higher VM target (here 1.5). This is likely asking for trouble when this happens.

In the particular scenario of this defect, it looks like the JRE container
resolution got confused somehow.
Passing on to JRE container owner.
Comment 5 Darin Wright CLA 2005-03-30 17:59:14 EST
Any steps to reproduce this error?
Comment 6 Darin Wright CLA 2005-04-18 15:54:06 EDT
Marking as won't fix without clear/simple steps to reproduce. It looks the 
problem has been worked-around.