title: Programming Java 7 in Eclipse
body: <p>I installed <a href="http://java.sun.com/javase/downloads/ea.jsp" rel="noreferrer">JDK 7</a> and <a href="http://download.eclipse.org/eclipse/downloads/drops/S-3.6M6-201003121448/index.php" rel="noreferrer">Eclipse 3.6M6</a>. Then, I added JRE 7 as a new JRE execution environment in Eclipse, and set the compiler compliance level to Java 7. I can compile the following piece of code through command line using the <code>javac</code> that comes with JDK 7. </p>
  
  <pre><code>import java.util.HashMap;
  import java.util.Map;
  
  public class Try {
  
      public static void main(String[] args) {
          Map&lt;Integer, String&gt; map = new HashMap&lt;&gt;();
      }
  }
  </code></pre>
  
  <p>But, Eclipse gives the following error messages.</p>
  
  <blockquote>
    <p>Incorrect number of arguments for type HashMap; it cannot be parameterized with arguments     Try.java    /TryJava7/src   line 7  Java Problem</p>
    
    <p>Syntax error on token "&lt;", ? expected after this token    Try.java    /TryJava7/src   line 7  Java Problem</p>
  </blockquote>
  
  <p>Even though I've set the compliance level of the compiler to Java 7, it looks like Eclipse doesn't understand Java7 syntax yet. Is it possible to play with Java 7 in Eclipse?</p>
  
  <p>The following is the content of <code>.classpath</code>.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;classpath&gt;
    &lt;classpathentry kind="src" path="src"/&gt;
    &lt;classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/&gt;
    &lt;classpathentry kind="output" path="bin"/&gt;
  &lt;/classpath&gt;
  </code></pre>
  
  <p>And, the following is the content of <code>.settings/org.eclipse.jdt.core.prefs</code>.</p>
  
  <pre><code>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
  </code></pre>