码迷,mamicode.com
首页 > 编程语言 > 详细

IntelliJ Idea中使用Java8新特性lambda表达式

时间:2018-07-31 11:18:36      阅读:344      评论:0      收藏:0      [点我收藏+]

标签:pac   java8新特性   ima   int   分享图片   apach   发行版   config   编译器   

环境: 环境变量JAVA_HOME配置jdk1.8

idea配置支持lambda:

    File -> Project Structure -> Modules ->  Language level, 选择: 8-Lambdas, type annotations etc.

    File -> Project Structure -> Project  ->  Project language level, 选择: 8-Lambdas, type annotations etc.

pom文件中对编译器的配置:

技术分享图片

<build>
<finalName>spark.hadoop.study</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showWarnings>true</showWarnings>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>

最后:核心是指定source为1.8, 否则编译会报如下错误:

Fatal error compiling: 无效的目标发行版

 

IntelliJ Idea中使用Java8新特性lambda表达式

标签:pac   java8新特性   ima   int   分享图片   apach   发行版   config   编译器   

原文地址:https://www.cnblogs.com/lomo-deng/p/9394062.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!