Search code examples
eclipse-kepler

Eclipse-Kepler, Java 8 compilation issue "syntax errors on tokens"


I am using Eclipse Kepler with jdk1.8.0. I do not face any compilation problems in import statements related to java8 or collect construct. However I get the compilation issue in:- Dish::getName...it says.. Syntax errors on tokens, delete the tokens.

Just trying to run the following code:

List<String> dishNames = menu.stream()
                              .map(Dish::getName)
                              .collect(toList());

System.out.println(dishNames);

Dish is a java object with String property name.

I have installed JDK8, added the latest JRE in eclipse Java Build Path. Java compiler compliance.

Any hints what something silly I am missing?


Solution

  • I think you missed installing support of java8 in eclipse kepler. You can follow this link for detailed instructions.

    https://wiki.eclipse.org/JDT/Eclipse_Java_8_Support_For_Kepler