I'm having a problem with Eclipse on by Mac OSX Mountain Lion. I have recently installed Android SDK and in my java projects I get the following message:
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
Reading about this issue, it would seem that I do not have a valid JRE defined in the build path of my project. Checking the project's build path with Properties > Java Build Path > Libraries I see that The JRE System Library has a red cross next to it. However when I click Add Library... > JRE System Library I get the message:
An error has occured. See error log for more details. java.lang.NullPointerException
I then try clicking Eclipse > Preferences > Java > Installed JREs and see an empty list. I try to Add... a Standard VM but I cannot find the location of my JRE. /Library/Java/JavaVirtualMachines/ is empty and /System/Library/Frameworks/JavaVM.framework does not exist.
Does anyone know how I might fix this problem?
To clean projects in Eclipse IDE: Go to Menu option –> Select Project –> click Clean… Note: The same can also be achieved by clicking CTRL + S (save) simultaneously in Eclipse IDE.
with Eclipse The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files This is the nice error message I got from Eclipse after the CVS checkout of a project. This error is kind of annoying because Object is the base of almost all Java entities, without it it’s impossible to create any Java class.
However I have set the path as C:\Program Files\Java\jdk1.6.0_41 from eclipse Kepler toolbar->windows->preferences->java->installed jre project->build path-> configure build path -> java build path -> libraries tab -> select JRE system library and click edit button -> If alternative JRE is selected choose workspace default JRE.
sometimes this error happened after updating JAVA. if so go to eclipse.ini file in the same folder where eclipse existed. then change the line under -vm keyward to the new path of jre/bin folder to get the path go to programfiles -> java -> jre latest version -> bin folder copy the path and replace in line under -vm keyword.
Close the project and reopen it. Clean the project (It will rebuild the buildpath hence reconfiguring with the JDK libraries) Delete and Re-import the project and if necessary do the above steps again. Same here. Bizarre Eclipse bug. The As the link says, removing the JRE library from project's classpath and re-add it fix the problem.
This worked for me :
Right Button in the Project: Build Path >> Configure Build Path >> Click JRE System Library >> Remove
Then click: Add Library >> JRE System Library >> Next >> Installed JREs >> Select JRE >> Ok >> Finish >> Apply
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With