No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

来源:互联网 发布:淘宝衣服模特同一个人 编辑:程序博客网 时间:2024/05/22 02:10

在maven工程中,当执行maven install命令时,显示错误:No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?,但实际上我们已经配置了jdk,那为什么会还会出现这种错误呢。下面的链接完美解决了我的问题。

解决办法为:

1、On your Eclipse IDE, go into Window > Preferences > Java > Installed JREs > and check your installed JREs. You should have an entry with a JDK there.2、Select the Execution Env as show below. Click OK3、Then Right-Click on your Project -> Maven -> Update Project

如果上面我们的配置都正确,还出现这种错误的原因,我个人感觉可能是eclipse内部已经加载了jre,我们有手动配置了我们想要的jre,因此我们可以手动设置一个默认的jre供maven来使用。步骤如下:

Additionally, you may have to change Maven JRE (see @jlars62 answer) which is as follows. Goto Run -> Run Configurations, selecting the Maven Build I was running (from the left panel). Then, I clicked the JRE tab and selected the option Workspace default JRE

这里写图片描述

经过以上步骤后,错误解决。

阅读全文
0 0
原创粉丝点击