Fatal error compiling: tools.jar not found

Issue:

[INFO] Scanning for projects...
[INFO]                                                                        
[INFO] ------------------------------------------------------------------------
[INFO] Building CommandsGUI 1.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ CommandsGUI ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ CommandsGUI ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ CommandsGUI ---
[INFO] Compiling 11 source files to C:\workspace\CommandsGUI\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.687 s
[INFO] Finished at: 2016-08-04T17:35:31+01:00
[INFO] Final Memory: 8M/20M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project CommandsGUI: Fatal error compiling: tools.jar not found: C:\Java\jdk1.8.0_74\jre\..\lib\tools.jar -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException


Solution:

Right Click on the project > Build Path > Configure Build Path
Select java build path >  Remove the old JRE e.g JRE 1.6
Add library
Select System JRE Library
Next
Click alternative JRE
Select the latest on and then Finish




1 comment:

  1. It is not worked for me. Is there any other solution??

    ReplyDelete

Please provide your input, it will honer for me...