I have installed netbeans (Apache version) with JDK 10 successfully, but can\'t use var
keyword in my project, It keep saying cannot find symbol
. A
If you are using maven project, make sure that maven.compiler.source and maven.compiler.target are all pointing to 10.
<properties>
<maven.compiler.source>10</maven.compiler.source>
<maven.compiler.target>10</maven.compiler.target>
</properties>
To use the var
keyword with JDK 10 in NetBeans:
var v = 7;
) within the main()
method.javac.source
and javac.target
. Verify that they both contain the value 10
.If there is still a "cannot find symbol" error for the var
declaration then there is something fundamentally wrong with the NetBeans installation, so update the OP with:
javac.source
and javac.target
in project.properties.