无法解析java.lang.object类型 - Eclipse buildpath无法正常工作 [英] The type java.lang.object cannot be resolved - Eclipse buildpath not working
问题描述
我遇到了Mac OSX Mountain Lion的Eclipse问题。我最近安装了Android SDK,在我的java项目中,我收到以下消息:
无法解析java.lang.Object类型。它从所需的.class文件间接引用
阅读这个问题,似乎我没有在项目的构建路径中定义有效的JRE。使用属性>Java构建路径>库检查项目的构建路径我看到JRE系统库旁边有一个红叉。但是,当我单击添加库...> JRE系统库时,我收到消息:
发生错误。有关详细信息,请参阅错误日志
java.lang.NullPointerException
然后我尝试单击Eclipse> Preferences> Java> Installed JREs并查看一个空列表。我尝试添加...标准虚拟机,但我找不到我的JRE的位置。 / Library / Java / JavaVirtualMachines /为空且/System/Library/Frameworks/JavaVM.framework不存在。
有谁知道如何解决这个问题?<这对我有用:
- 右键单击您的项目 - >构建路径 - >配置构建路径
- 转到库选项卡
- 单击添加库 - > JRE系统库 - >下一步 - >工作区默认JRE(或者您可以添加备用JRE) - >完成
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?
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
这篇关于无法解析java.lang.object类型 - Eclipse buildpath无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!