The type java.lang.object cannot be resolved - Eclipse buildpath not working
Asked Answered
B

3

7

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?

Basement answered 16/8, 2014 at 5:21 Comment(2)
Download a new JRE and add it in eclipseMiniver
I have downloaded a new JRE but do not know where it's root directory is.Basement
B
11

This worked for me :

  • Right click on your project -> Build Path -> Configure Build Path
  • Go to 'Libraries' tab
  • Click on 'Add Library' -> JRE System Library -> Next -> Workspace default JRE (or you can add Alternate JRE) -> Finish
Bonkers answered 15/5, 2015 at 11:4 Comment(0)
C
4

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

Commix answered 11/8, 2016 at 2:33 Comment(0)
D
1

You can follow instruction to install a JDL (which includes a JRE) for Mac here.

Depending on your processor, the downloaded file has one of the following names:

  • jdk-8uversion-macosx-amd64.dmg
  • jdk-8uversion-macosx-x64.dmg

Where version is 6 or later.

  • Download the file.
  • Before the file can be downloaded, you must accept the license agreement.
  • From either the Downloads window of the browser, or from the file browser, double click the .dmg file to launch it.
    A Finder window appears containing an icon of an open box and the name of the .pkg file.
  • Double click the package icon to launch the Install app.
Derose answered 16/8, 2014 at 10:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.