博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
m2e (maven eclipse) 在运行一些命令时出现了无法compile(Unable to locate the Javac Compiler in:)...
阅读量:4490 次
发布时间:2019-06-08

本文共 1283 字,大约阅读时间需要 4 分钟。

出现的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时,你需到仓库去把这些已存在的版本删除即可

转载于:https://www.cnblogs.com/silentjesse/archive/2012/10/17/2727407.html

你可能感兴趣的文章
迭代器
查看>>
多线程共享全局变量(加锁)
查看>>
gevent 完成多任务_2
查看>>
判断该url下面是否包含指定的文件
查看>>
greenlet
查看>>
域名生成
查看>>
邮箱判断
查看>>
网页简体变为繁体
查看>>
gevent 完成多任务
查看>>
school
查看>>
python之钉钉机器人zabbix报警
查看>>
nginx配置文件服务器 linux
查看>>
使用safe-rm替换rm命令,防止误删除
查看>>
自定义注解及写一个自定义注解防止数据重复提交
查看>>
springboot发送email邮件
查看>>
nginx安装配置
查看>>
springcloud-alibaba手写负载均衡的坑,采用restTemplate,不能添加@loadbalanced注解,否则采用了robbin...
查看>>
nacos作为配置中心动态刷新@RefreshScope添加后取值为null的一个问题
查看>>
springcloud gateway 项目打包部署运行
查看>>
windows通过zip安装mysql5.7.26的一个坑
查看>>