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

在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 OK
3、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

这里写图片描述

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值