Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin (default-compile) on project: Fatal error compiling: tools.jar not found

I have done all the steps provided in http://www.tutorialspoint.com/jsf/jsf_environment_setup.htm

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.

It gives this error

"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"

What should I do?

like image 738
abdul khan Avatar asked Apr 17 '15 13:04

abdul khan


People also ask

Does Maven work with Java 17?

In case of Maven, we specify the compiler plugin to use Maven with Java 17. The next step is to basically upgrade the dependencies of our application.

How do I fix Mojo failure exception?

Right click on Project-> Properties--> select project facets--> choose Java correct version which is installed on your system. Then it will works fine.


1 Answers

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.

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

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".

like image 53
Shane Voisard Avatar answered Oct 15 '22 02:10

Shane Voisard