简体   繁体   English

使用NetBeans 8但低于Lambda表达式的编译错误

[英]Using NetBeans 8 but getting below compilation error for Lambda expression

I am using NetBeans 8. When my code contains a Lambda expression and I try to compile, I get the following error message: 我正在使用NetBeans 8.当我的代码包含Lambda表达式并尝试编译时,我收到以下错误消息:

lambda expression not expected here

lambda expressions are not supported in -source 1.5
  (use -source 8 or higher to enable lambda expressions)
----
(Alt-Enter shows hints)

Please click right from you project -> Properties -> Choose Sources -> (you will see Source/Binary Format) change it to 1.8 -> Click OK. 请从项目中单击右键 - >属性 - >选择源 - >(您将看到源/二进制格式)将其更改为1.8 - >单击确定。

Or you can see in this link http://tinadev.blogspot.com/2015/08/lambda-expression-not-expected-here.html 或者你可以在这个链接中看到http://tinadev.blogspot.com/2015/08/lambda-expression-not-expected-here.html

Thanks 谢谢

对于NetBeans IDE 8.2,JDK 8

将源代码的编译器版本更改为项目属性为jdk 8,并首先检查是否已安装。

在项目属性对话框中,在左侧面板中选择“源”,然后在右下角查找“源/二进制格式”,将其更改为JDK 8。

Download JDK 1.8 to resolve this issue. 下载JDK 1.8以解决此问题。 change the JAVA_HOME environment variables path to jdk_1.8. 将JAVA_HOME环境变量路径更改为jdk_1.8。 Right Click on the project folder which has the above mentioned compilation error and select properties. 右键单击具有上述编译错误的项目文件夹并选择属性。 In Sources tab change the source/binary format to JDK 8. In libraries change Java Platform to JDK 1.8. 在Sources选项卡中,将源/二进制格式更改为JDK 8.在库中将Java Platform更改为JDK 1.8。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM