您的位置:首页 > 编程语言 > Java开发

Unable to locate the Javac Compiler in 错误的解决办法之一

2017-05-27 15:15 651 查看
在eclipse中使用maven install的时候,出现了以下错误导致build失败。

Unable to locate the Javac Compiler in:

  F:\Program Files\Java\jre1.8.0_111\..\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.

仔细看看应该是路径的问题,然后再其所提示的目录F:\Program Files\Java\jre1.8.0_111\..\lib\下并没有发现tools.jar。到这里应该是找不到这个类。然后在jdk的安装目录中找到了tools.jar。

百度了一下jdk和jre的关系。发现jdk中包含了jre。在此,可能就是eclipse中的设置有问题了。

在eclipse中window 下的preference中的installed jres。


在把jre路径换成jdk路径。重新maven install成功。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐