Error Cannot Read Java.lang.object
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Java project in Eclipse: The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files up vote 123 down vote favorite 27 I am getting the following error after importing a project in Eclipse: The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files However, I have set the path as C:\Program Files\Java\jdk1.6.0_41 in Eclipse Kepler, through Menu » Window » Preferences » Java » Installed JREs. java eclipse share|improve this question edited Jul 23 '14 at 10:25 MC Emperor 4,02573675 asked Aug 6 '13 at 8:36 Blue Diamond 7293815 i made "copy project" and error disappeared –Srinath Ganesh Feb 8 '14 at 4:04 add a comment| 12 Answers 12 active oldest votes up vote 160 down vote accepted This is an annoying Eclipse Bug which seems to bite now and then. See http://dev-answers.blogspot.de/2009/06/eclipse-build-errors-javalangobject.html for a possible solution, otherwise try the following; Close the project and reopen it. Clean the project (It will rebuild the buildpath hence reconfiguring with the JDK libraries) OR Delete and Re-import the project and if necessary do the above steps again. The better cure is to try NetBeans instead of Eclipse :-) share|improve this answer edited Jan 24 '14 at 15:23 4D - Problem Solver 43948 answered Aug 6 '13 at 8:57 Gyro Gearless 3,26921114 1 Thanks Gyro, the link helped me in fixing the bug. –Blue Diamond Aug 6 '13 at 12:20 3 Same here. Bizarre Eclipse bug. The As the link says, removing the JRE library from project's classpath and re-add it fix t
eclipse 3.4.0 ganymede The type java.lang.object "cannot be resolved" "Cannot find the class file" "refers to the missing type" Problem: Opened eclipse, it needed to do a full workspace build (probably because ant scripts have updated class files and it needs to refresh). Random classes in the project now no longer compile. Examples of the errors being reported: DescriptionResourcePathLocationType The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class filesMyClass.javaMyProject/src/com/exampleline http://stackoverflow.com/questions/18075343/java-project-in-eclipse-the-type-java-lang-object-cannot-be-resolved-it-is-ind 1Java Problem 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 projectMyProjectUnknownJava Problem The method myMethod(SomeClass) from the type MyOtherClass refers to the missing type (insert java type here: InputStream|File|Vector|IOException|etc)MyOtherClass.javaMyProject/src/com/exampleline 123Java Problem Solution: It sounds like this has http://dev-answers.blogspot.com/2009/06/eclipse-build-errors-javalangobject.html been a known issue (Bug 67414)that was resolved in 3.0 ... someone has commented that it's occurring for them in 3.4 as well. In the mean time, the work around is to remove the JRE System Library from the project and then add it back again. Here are the steps: Go to properties of project with the build error (right click > Properties) View the "Libraries" tab in the "Build Path" section Find the "JRE System Library" in the list (if this is missing then this error message is not an eclipse bug but a mis-configured project) Remove the "JRE System Library" Hit "Add Library ...", Select "JRE System Library" and add the appropriate JRE for the project (eg. 'Workspace default JRE') Hit "Finish" in the library selection and "OK" in the project properties and then wait for the re-build of the project Hopefully the error will be resolved ... Posted by Kevin Jansz at 10:46 am Labels: eclipse, error messages 42 comm
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 http://www.thecodingforums.com/threads/jdk-1-6-will-not-compile-cannot-access-java-lang-object.585364/ 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! , Jan 17, 2008 #1 Advertisements Jonatan Kazmierczak Guest wrote: error cannot > 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 Hi, typical problem for window$ users - curse of PATH env. var. Your OS runs old error cannot read 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 Kazmierczak SCJP SCJD TC_rated_member Asm86 Bash C/C++ Java JavaScript Pascal Perl PHP Ruby TCL VB VBScript Jonatan Kazmierczak, Jan 17, 2008 #2 Advertisements Roedy Green Guest On 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 For a brute force fix, uninstall all JREs and JDKs. Manually prune any 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 Products The Java Glossary, http://mindprod.com Roedy Green, Jan 17, 2008 #3 Roedy Green Guest On Thu, 17 Jan 2008 07:14:20 -0800 (PST), 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 Roedy Green, Jan 17, 2008 #4 Lew Guest (multi-post unified) wrote: >>> I just instal