Reputation: 863
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?
Upvotes: 16
Views: 71460
Reputation: 131
I am using windows OS with JDK 1.9 in eclipse Oxygen. I faced this issue while compiling the project with JDK 1.9 while using maven and I solved by changing mvn.cmd
file present in C:\apache-maven-3.5.2\bin
.
Before:
set "JAVACMD=C:\Program Files\Java\jdk-9.0.1\bin\java.exe"
After:
set "JAVACMD=C:\Program Files\Java\jdk1.8.0_91\bin\java.exe"
Also, make sure the compiler you use to build the project is correctly configured in IDE you use.
Upvotes: -1
Reputation: 1
Delete repository from .m2 -> repository
and then right click on the project Run as... -> Maven install
.
After that, again right click on the project Maven -> Update project -> Check Update of Snapshots
and click on the Ok
option.
Upvotes: 0
Reputation: 1679
Check the JAVA version, It should be same across all the places. See screenshots.
Note: To see configuration window for 2 and 3... right click on the project and click properties
Upvotes: 1
Reputation: 1145
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".
Upvotes: 39