目录
一直在用scala编写Spark或者Flink代码,对于Java的lambda表达式一直认为没有前者一直点(“.”)下去方便,偶然用后者写代码中间出现一些小的设置问题,记录一下:
示例代码
...... final LocalEnvironment env = ExecutionEnvironment.createLocalEnvironment(); final DataSource<Integer> source = env.fromElements(1, 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5); source .map(i->i*i) .print(); ......
Error:(18, 15) java: -source 1.5 中不支持 lambda 表达式
Information:java: Errors occurred while compiling module 'flink-suit' Information:javac 1.8.0_181 was used to compile java sources Information:Module "flink-suit" was fully rebuilt due to project configuration/dependencies changes Information:2018/10/1 下午7:17 - Compilation completed with 1 error and 4 warnings in 4s 948ms Warning:scalac: there was one deprecation warning; re-run with -deprecation for details Warning:java: 源值1.5已过时, 将在未来所有发行版中删除 Warning:java: 目标值1.5已过时, 将在未来所有发行版中删除 Warning:java: 要隐藏有关已过时选项的警告, 请使用 -Xlint:-options。 /Users/neters/computing/flink-suit/src/main/java/com/yidian/data/api/LambdaAPI.java Error:(18, 15) java: -source 1.5 中不支持 lambda 表达式 (请使用 -source 8 或更高版本以启用 lambda 表达式)
解决方法
右键点击工程名->”Open Module Setting”
Error:java: Compilation failed: internal java compiler error
Information:java: javacTask: 源发行版 1.8 需要目标发行版 1.8 Information:java: Errors occurred while compiling module 'flink-suit' Information:javac 1.8.0_181 was used to compile java sources Information:2018/10/1 下午7:17 - Compilation completed with 1 error and 1 warning in 2s 899ms Error:java: Compilation failed: internal java compiler error Warning:scalac: there was one deprecation warning; re-run with -deprecation for details
解决方法: