環境: 環境變量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: 無效的目標發行版
