Maven – Fatal error compiling: tools.jar not found

You might quite experience the tools.jar not found when trying to compile using Maven.  This is because when you do the compilation, maven is trying to look for a tools.jar which is not available for the compilation and hence you get this exception.

Error

Fatal error compiling: tools.jar not found: C:\Program Files\Java\jre6\..\lib\tools.jar -> [Help 1]

Resolution:

Make sure, you have the JDK in the installed JRE and selected for your compilation needs.

In Eclipse,

Goto Windows -> Preferences
Java -> Installed JREs – > Execution Environment
JavaSE1.x -> JDE 1.x

Eclipse Preferences
Eclipse Preferences

If you don’t have the JDK in the Installed JRE, then
Select the Installed JRE and Add the JDK installed path

7 Comments

  • Manoj says:

    Really very nice very useful.

    thanks a lot.

  • ASB says:

    Thank you very much!

  • Wingzzz says:

    Yeah this helped solve my issue real quick! Thanks a million for the great post!

  • mimil says:

    thanks ! I downloaded full JDK.

  • ajayram198 says:

    Hi I am new to Maven and Java, and while running a Hello World Program using Maven I am getting a warning and an error
    which: no javac in (/usr/lib/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/milli/bin)
    Warning: JAVA_HOME environment variable is not set.

    Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project M101J: Fatal error compiling: tools.jar not found: /usr/java/jre1.6.0_22/../lib/tools.jar -> [Help 1]

    —-

    I dont have any IDE installed on my machine, Is it required to have an IDE? And how do you resolve this problem on a Linux machine?

    • Muruga says:

      You don’t need to install IDE.

      no javac in (/usr/lib/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/milli/bin)

      which means that your javac.sh is not on the path. export JAVA_HOME to your JDK path (up to the BIN directory). Once you do it, you should be able to run Maven.

Leave a Reply

Pinterest
Email