I installed JDK 7 and Eclipse 3.6M6 . Then I added JRE 7 as the new JRE runtime in Eclipse and set the Java 7 compiler compliance level. I can compile the following code fragment through the command line using javac that comes with JDK 7.
import java.util.HashMap; import java.util.Map; public class Try { public static void main(String[] args) { Map<Integer, String> map = new HashMap<>(); } }
But Eclipse provides the following error messages.
Invalid number of arguments for type HashMap; it cannot be parameterized using Try.java/TryJava7/src line 7 arguments. Java problem
Syntax error on token "<" ,? expected after this token Try.java/TryJava7/src line 7 Problem with Java
Although I set the Java 7 compiler to match level, it seems like Eclipse does not yet understand the Java7 syntax. Can I play with Java 7 in Eclipse?
The following is the contents of the .classpath .
<?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> <classpathentry kind="output" path="bin"/> </classpath>
And here is the contents of .settings/org.eclipse.jdt.core.prefs .
eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.7
java eclipse java-7
reprogrammer Apr 14 '10 at 15:18 2010-04-14 15:18
source share