JDK 8 - "The type java.util.Map$Entry cannot be resolved" [duplicate]
Im trying to use a HashMap but getting the error:
"The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files"
I'm using JDK 8 along with Eclipse.
Anybody know why?
My code
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Map;
import java.util.HashMap;
public class Analyser {
public void analyse() throws FileNotFoundException {
HashMap<String, Integer> candyMap = new HashMap<String, Integer>();
BufferedReader br = new BufferedReader(new FileReader("Candy.txt"));
for(String s=br.readLine(); s!=null; s=br.readLine()) {
System.out.println(s);
}
}
}
This was fixed by changing my Eclipse IDE version from indigo to luna. Luna comes with support for Java 8 so all issues have now been resolved.