Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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);
        }       

    }
}
like image 470
Dom Shahbazi Avatar asked Nov 02 '14 15:11

Dom Shahbazi


1 Answers

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.

like image 173
Dom Shahbazi Avatar answered Sep 21 '22 08:09

Dom Shahbazi