Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (3.9k points)

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 Window » Preferences » Java » Installed JREs

2 Answers

0 votes
by (46k points)

his is an irritating Eclipse Bug which appears to bite now and then. See http://dev-answers.blogspot.de/2009/06/eclipse-build-errors-javalangobject.html for a possible solution, unless try the following;

  • Close the project and resume it.
  • Clean the project (It will restore the buildpath hence reconfiguring with the JDK libraries)

OR

  • Delete and Re-import the project and if required do the above steps again.

The better cure is to try NetBeans rather of Eclipse :-)

0 votes
by (1.1k points)
To fix running into the java.lang.Object cannot be resolved issue in Eclipse, perform the following:

Set up JDK in the Build Path:

Right Click on the project and hover on the Build Path, then select correct Configure Build Path.

In the Libraries tab, remove any JRE System Library if present.

Press Add Library… > JRE System Library > Next, and either select the Workspace Default JRE or any installed JDK.

Press Finish and then Apply and Close.

Check the Installed JRE is Correct:

Go to the Window > Preferences > Java > Installed JREs.

Ensure that you have checked the JDK (not only JRE) which is set to the correct path.

Cleans and Re Compiles the Project:

Click on Project > Clean… > select your project > press OK.

This should solve the issue at hand.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Aug 13, 2019 in Java by Nigam (4k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...