intellij idea Jdk编译设置

时间:2021-10-17 15:28:00

Idea加载多项目时因为不同JDK,经常出现JDK编译版本的问题,容易出现以下异常。

一、异常信息:

Information:Using javac 1.8.0_91 to compile java sources
Information:java: javacTask: 源发行版 1.8 需要目标发行版 1.8
Information:java: Errors occurred while compiling module 'spring-context'
Information:Module "spring-context" was fully rebuilt due to project configuration/dependencies changes
Information:2016/12/1 14:41 - Compilation completed with 1 error and 0 warnings in 12s 125ms
Error:java: Compilation failed: internal java compiler error

二、处理方法:

1. 修改 “Language level” 和 “Module SDK”

选择 File --> project Structure --> Modules,选择项目修改 “Sources” 选项卡下的 “Language level” 及 “Dependencies”选项卡下的 “Module SDK” 。

intellij idea Jdk编译设置

intellij idea Jdk编译设置

2. 修改Java Compiler

File --> Settings --> Build,Execution,Deployment --> Compiler --> java Compiler
intellij idea Jdk编译设置