在eclipse中使用maven install的时候,出现了以下错误导致build失败。
Unable to locate the Javac Compiler in:
F:\Program Files\Java\jre1.8.0_111\..\lib\tools.jarPlease 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成功。