ERROR - Could not find artifact jdk.tools:jdk.tools:jar: at specified path /lib/tools.jar

Error

Failed to execute goal on project : Could not resolve dependencies for project jar: Could not find artifact jdk.tools:jdk.tools:jar: at specified path /../lib/tools.jar

while building projects using Maven.

Cause


1. Tools.jar is not available at the specified location. There could be 2 reasons for it.

a. You didn't downloaded JDK and just installed JRE.
b. Your JAVA_HOME is not set to the correct directory.

2. Problem with the POM Dependencies

3. Problem due to different paths ( \ / ) on Windows and Unix.


Resolution

Make sure that tools.jar is available at the location specified in error. If you have installed only JRE , install JDK and set the JAVA_HOME appropriately.

If it doesn't resolve by above, add the following entry in your POM file

<dependency>
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
<version>1.6</version>
<scope>system</scope>
<systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
</dependency>