欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

IntelliJ Idea编译报错:javacTask: 源发行版 1.7 需要目标发行版 1.7,intellijjavactask

来源: javaer 分享于  点击 24064 次 点评:51

IntelliJ Idea编译报错:javacTask: 源发行版 1.7 需要目标发行版 1.7,intellijjavactask


IntelliJ Idea编译报错:

[java] view plain copy
  1. Information:Using javac 1.7.0_79 to compile java sources  
  2. Information:java: javacTask: 源发行版 1.7 需要目标发行版 1.7  
  3. Information:java: Errors occurred while compiling module 'xxx'  
  4. Information:15/8/14 下午11:08 - Compilation completed with 1 error and 0 warnings in 1s 913ms  
  5. Error:java: Compilation failed: internal java compiler error      

参考了附录中的文章,作如下修改(Idea版本14.1.4):

File-->Other Settings-->Default Settings-->Compiler-->Java Compiler

在Per-module bytecode version下点击“+”,出现的Choose Module框中是空白,无法修改Target bytecode version.

选择项目,右击选择“Open Project Settings”-->Modules-->Language Level,改成6、7、Project Default都不起作用,折腾半天。



在Stackoverflow上偶然搜索到如下说明(http://stackoverflow.com/questions/12900373/idea-javac-source-release-1-7-requires-target-release-1-7):

[java] view plain copy
  1. I've hit this after just minor upgrade from IntelliJ IDEA 14 to v14.1. For me changing an edit of top/parent pom helped and then clicked re-import Maven (if it is not automatic).  
  2.   
  3. But it maybe just enough to Right Click on module(s)/aggregated/parent module and Maven -> Reimport.  

选中项目,右击选择Maven-->Reimport, 再次编译,问题解决。



-------------------------附录------------------------ 

http://loftor.com/archives/idea-javacTask.html

在idea中编译时发生如下的错误

Information:Using javac 1.7.0_75 to compile java sources
Information:java: javacTask: 源发行版 1.6 需要目标发行版 1.6
Information:java: Errors occurred while compiling module 'kulong'
Information:15/3/26 13:22 - Compilation completed with 1 error and 0 warnings in 5s 771ms
Error:java: Compilation failed: internal java compiler error

解决办法

setting->Compiler->Java Compiler 设置相应Module的target byte code version的合适版本就行来。

相关文章

    暂无相关文章
相关栏目:

用户点评