更多>>Java程序设计 Blog

The compiler compliance specified is 1.8 but a JRE 12 is used

在使用 Spring Tool Suite 的时候,出现The compiler compliance specified is 1.8 but a JRE 12 is used警告的解决方法

一、具体问题

1、在工程名的图标上有个黄色叹的图标,如图所示:

2019-07-26_105708.jpg

2、点开Problems,发现具体的警告信息内容如下:

The compiler compliance specified is 1.8 but a JRE 12 is used

意思是说你指定的编译器版本号为1.8,而你实际安装使用的JRE 12

如图所示:

2019-07-26_105716.jpg

3、自己安装使用的JDK版本号为JDK12


二、解决方案

1、右键点击工程项目图标 demo,选择弹出菜单的最底部的“Perproties”

2、在弹出的窗口中点击“Java Compiler”,在右侧的窗口中 JDK Compliance 一项中,不勾选

然后,Compiler compliance level 这一项由灰色变成高亮显示,在后面的列表选择框中,将默认显示的1.8,修改为12

如图所示:

2019-07-26_105723.jpg

3、点击“Apply”,点击“Apply and Close”

4、相应的同步修改 pom.xml 文件中的java版本号

修改前:

<properties>

<java.version>1.8</java.version>

</properties>

修改后:

<properties>

<java.version>12</java.version>

</properties>

5、警告信息消失,问题解决


评论列表

no_photo
Thank you For your hard work o  
Thank you For your hard work over the years! For this, we give you the opportunity. https://google.com#1234567890 For more information, see the instructions. skfhjvkjsdjsrbhvbsrfhkis

2023-09-06 03:45:53

no_photo
Push it to the limit cool Wolf  
Push it to the limit cool Wolf you are the best and you can do everything https://www.samsung.com smkmkplobydlmcrjmzgvx

2023-08-15 02:28:01

发表评论

用来接收审核回复提醒,请认真填写

  换一张?
captcha
看不清?点击图片换一张