m2e (maven eclipse) 在运行一些命令时出现了无法compile(Unable to locate the Javac Compiler in:)...

出现的bug提示

Unable to locate the Javac Compiler in:
C:\Program Files\Java\jre1.6.0_07\..\lib\tools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
In most cases you can change the location of your Java
installation by setting the JAVA_HOME environment variable.

从上面的Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required)

可以看出m2e要求用于编译应该要用jdk且jdk是1.4及以上的版本才行

我在命令行下echo %JAVA_HOME%

检查了一下我的"JAVA_HOME"是C:\Program Files\Java\jdk1.6.0_20

那是哪里出错了呢,,这时我意识到我用的是m2e,那么我的运行时环境应该就是根据

eclipse(eclipse也有默认也有自己的运行时环境)指定的才是,,那么我只要把修改eclipse指定的运行时环境路径不就可以了,

于是

1、在eclipse里面修改 "window-->preferences->java->installed jres" 如图:

edit the selected jre or add a new jre and select it  

the location should be "C:\Program Files\Java\jdk1.6.0_20\jre"

please don't close the "Edit JRE" dialog ,continue the second step.

2、remove the default jre system libraries and add all the jar in  the lib folder, lib subdirectory in  %JAVA_HOME%/jdk**/jre/

illustration:

 

_^^_.......I wish this bug report message will help u....and please comment this ...

 

 

 

 

在用maven的这些日子以来,发现还有一种可能出现这种错误,就是你已经install了你的项目,,这时出现这种bug时,你需到仓库去把这些已存在的版本删除即可

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值