无法解析java.util.Map $ Entry类型。它是从所需的.class文件间接引用的 [英] The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files
问题描述
import java.util.HashMap;
public class Demo {
public static void main(String [] args){
HashMap< String,String> hash = new HashMap();
}
}
上述程序会产生以下错误。 >
- 该项目由于其构建路径不完整而未构建。找不到java.util.Map $ Entry的类文件。修复构建路径,然后尝试构建此项目。
- 无法解析java.util.Map $ Entry类型。它是从所需的.class文件间接引用的。
我几乎遍布互联网搜索,但我无法纠正这一点。
我已经安装了Java SE 8u5(JDK)( http://www.oracle.com/technetwork/java/javase/downloads/index.html?ssSourceSiteId=otnjp )
- Windows - >首选项 - >已安装的JRE显示
a)jdk C:\Program文件\Java\jdk
- 项目 - >构建路径 - >库显示
a)JRE系统库(jdk)
b)JRE系统库(jre8)
请有人帮助我。
编辑:将Eclipse版本从Helios更改为Juno解决了问题!
我已经看到Eclipse forg偶尔出现的问题存在内置类(包括 Object
和 String
)。解决方法是:
- 在项目菜单上,关闭自动生成
- 退出并重新启动Eclipse
- 在项目菜单上,选择清除...并清除所有项目
- 将自动构建这样可以让Eclipse重新生成所有的东西。
>
I am writing a simple Java program on Eclipse.
import java.util.HashMap;
public class Demo {
public static void main(String[] args) {
HashMap<String, String> hash = new HashMap();
}
}
The above program generates the following errors.
- The project was not built since its build path is incomplete. Cannot find the class file for java.util.Map$Entry. Fix the build path then try building this project.
- The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files.
I searched over the internet almost everywhere, but I was not able to correct this.
I have installed Java SE 8u5 (JDK) (http://www.oracle.com/technetwork/java/javase/downloads/index.html?ssSourceSiteId=otnjp)
- Windows -> Preferences -> Installed JREs shows
a) jdk C:\Program Files\Java\jdk
- Project -> Build Path -> Libraries shows
a) JRE system library (jdk)
b) JRE system library (jre8)
Please somebody help me.
EDIT: Changing Eclipse version from Helios to Juno solved the problem!
I've seen occasional problems with Eclipse forgetting that built-in classes (including Object
and String
) exist. The way I've resolved them is to:
- On the Project menu, turn off "Build Automatically"
- Quit and restart Eclipse
- On the Project menu, choose "Clean…" and clean all projects
- Turn "Build Automatically" back on and let it rebuild everything.
This seems to make Eclipse forget whatever incorrect cached information it had about the available classes.
这篇关于无法解析java.util.Map $ Entry类型。它是从所需的.class文件间接引用的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!