Java 7 Syntax error

java-7

Solution

On Eclipse's Project|Properties dialog, there two entities `Java Build Path` and `Java Compiler`. The former will tell you what classes are used during the build, and you may have a Java 7 JRE listed there. The latter, however, is the compiler that will be used to compile your code. It is possible to have Eclipse use a Java 6 compiler even with a Java 7 JRE on the build path.

My guess is that you are using Helios, not Indigo. See Programming Java 7 in Eclipse

Problem

I have Java 7 running on my mac: ``` System.out.println(System.getProperty("java.version")); // prints 1.7.0_05 ``` Project was created using Project properties confirm, i am on Java 7 Default system Java is 7 The following however results in syntax error ``` public static void main(String[] args) { // Underscores in Numeric Litarals are ok here int i = 11_234; } ``` Eclipse is complaining with `Syntax error on token "_234", delete this token`

Original source

Related problems