无法解析java.util.Map $ Entry类型。它是从所需的.class文件间接引用的 [英] The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files

查看:5589
本文介绍了无法解析java.util.Map $ Entry类型。它是从所需的.class文件间接引用的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse上编写一个简单的Java程序。

  import java.util.HashMap; 

public class Demo {
public static void main(String [] args){
HashMap< String,String> hash = new HashMap();
}
}

上述程序会产生以下错误。 >


  1. 该项目由于其构建路径不完整而未构建。找不到java.util.Map $ Entry的类文件。修复构建路径,然后尝试构建此项目。

  2. 无法解析java.util.Map $ Entry类型。它是从所需的.class文件间接引用的。

我几乎遍布互联网搜索,但我无法纠正这一点。



我已经安装了Java SE 8u5(JDK)( http://www.oracle.com/technetwork/java/javase/downloads/index.html?ssSourceSiteId=otnjp


  1. Windows - >首选项 - >已安装的JRE显示

a)jdk C:\Program文件\Java\jdk


  1. 项目 - >构建路径 - >库显示

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.

  1. 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.
  2. 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)

  1. Windows -> Preferences -> Installed JREs shows

a) jdk C:\Program Files\Java\jdk

  1. 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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆