[java] The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files

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!

This question is related to java eclipse hashmap libraries

The answer is


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.


Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to eclipse

How do I get the command-line for an Eclipse run configuration? My eclipse won't open, i download the bundle pack it keeps saying error log strange error in my Animation Drawable How to uninstall Eclipse? How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Class has been compiled by a more recent version of the Java Environment Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory How to downgrade Java from 9 to 8 on a MACOS. Eclipse is not running with Java 9 "The POM for ... is missing, no dependency information available" even though it exists in Maven Repository The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on deploying to tomcat

Examples related to hashmap

How to split a string in two and store it in a field Printing a java map Map<String, Object> - How? Hashmap with Streams in Java 8 Streams to collect value of Map How to convert String into Hashmap in java Convert object array to hash map, indexed by an attribute value of the Object HashMap - getting First Key value The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files Sort Go map values by keys Print all key/value pairs in a Java ConcurrentHashMap creating Hashmap from a JSON String

Examples related to libraries

Gradle failed to resolve library in Android Studio Add external libraries to CMakeList.txt c++ The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files fatal error LNK1104: cannot open file 'kernel32.lib' Node.js Logging The project was not built since its build path is incomplete libstdc++-6.dll not found How to add local jar files to a Maven project? How to add additional libraries to Visual Studio project? Java out.println() how is this possible?