无法执行目标org.apache.maven.plugins:项目中的maven-compiler-plugin(default-compile):致命错误编译:未找到tools.jar [英] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin (default-compile) on project: Fatal error compiling: tools.jar not found

查看:1533
本文介绍了无法执行目标org.apache.maven.plugins:项目中的maven-compiler-plugin(default-compile):致命错误编译:未找到tools.jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经完成了 http://www.tutorialspoint.com/jsf/jsf_environment_setup.htm

Apache Maven和Apache tomcat都准备好了。我也设置了环境。我在Eclipse中创建了Maven项目,当我使用Maven构建程序运行时,它提供了Build Failure。

Apache Maven and Apache tomcat both are ready. I also set the environments. I created Maven project in Eclipse, it gives Build Failure while I run this using Maven build.

它给出了这个错误


无法执行目标org.apache.maven.plugins:maven-compiler-plugin:2.5.1:在项目Hello2上编译(默认编译):致命错误编译:tools.jar找不到:C:\Program Files\Java\jre1.8.0_40..\lib\tools.jar

"Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project Hello2: Fatal error compiling: tools.jar not found: C:\Program Files\Java\jre1.8.0_40..\lib\tools.jar"

我该怎么办?

推荐答案

您需要将eclipse的默认安装jre设置为jdk。 Eclipse窗口菜单=>首选项=>在左侧导航窗格中输入搜索字符串jre=>单击左侧导航窗格中的已安装的JRE=>单击添加并浏览到您的JDK。 =>单击JDK旁边的复选框将其设置为默认值。

You need to set eclipse's default installed "jre" to a jdk. Eclipse Window Menu => Preferences => enter search string "jre" in left navigation pane => click on "Installed JREs" in left navigation pane => Click Add and browse to your JDK. => click the check box next to the JDK to make it default.

您可能需要下载并安装java jdk(如果您还没有安装)。

You may need to download and install the java jdk if you don't already have it.

另外确保eclipse运行配置设置为使用您设置的默认jdk:运行菜单=>运行配置=>选择项目的运行配置(Maven构建)=>单击JRE选项卡=>运行时JRE选择工作空间默认值 。

Also ensure the eclipse run configuration is set to use the default jdk you set up: Run Menu => Run Configurations => Select the run config for your project (Maven Build) => Click JRE tab => Under Runtime JRE select "workspace default".

这篇关于无法执行目标org.apache.maven.plugins:项目中的maven-compiler-plugin(default-compile):致命错误编译:未找到tools.jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆