IntelliJ IDEA报错总结

不能运行java程序

可能是没有选择运行环境
点击 edit Configurations
在Use classpath of module 中选择本项目的运行环境

 

Run报错: 

Error:java: Compilation failed: internal java compiler error

a.进入Feil--->Settings...--->Build Tools--->Java Compiler
b.Per-module bytecode version:中
Module 选择对应的项目
Target bytecode version 选择对应当前设置的java版本

@Override报错:

设置

Feil->Project Structure...->Modules->
Sources->Language level->6-@Override in interfaces

在Maven项目中每次修改了pom.xml文件后Language level可能会重置

所以使用maven插件方便

<build>
<plugins>
<!-- 使用maven-compiler-plugin 同时配置Java compiler和Language level -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
posted @ 2018-02-08 16:48  有悟还有迷  阅读(443)  评论(0编辑  收藏  举报