Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing tools-1.6.jar with Eclipse and Maven

I am trying to get a project to run using Maven in Eclipse, but I am getting this error below. The tools.jar is in the JDK's lib folder, but tools-1.6.jar doesn't seem to exist on my computer. I am using the JDK 1.7 and my JAVA_HOME is pointing to that folder (as is my eclipse.ini) Anyone know where I can get this file or what I might be doing wrong?

The container 'Maven Dependencies' references non existing library C:\Users\sejohnson\.m2\repository\com\sun\tools\1.6\tools-1.6.jar

like image 457
Soren Johnson Avatar asked Aug 27 '11 20:08

Soren Johnson


People also ask

How do I resolve a missing jar in Maven repository?

Look in your . m2 directory (use the paths which you see in the dialog above) and check whether the files are there or whether they are really missing. If they are missing, run "mvn install" (see the "Run as..." menu) to download them.

Is Maven available in Eclipse?

Most Eclipse IDE downloads already include support for the Maven build system. To check, use Help About and check if you can see the Maven logo (with the M2E ) sign.

How do I view maven in eclipse?

To check maven is configured properly: Open Eclipse and click on Windows -> Preferences. Choose Maven from left panel, and select installations. Click on Maven -> "User Settings" option form left panel, to check local repository location.


2 Answers

The tools-x.y.z.jar should be provided by your JDK.

Make sure that eclipse is run by JDK and not by JRE by adding -vm option in eclipse.ini.

For example:

-vm
C:\Program Files\Java\jdk1.6.0_26\bin\javaw

New line after -vm is crucial.

it should be right above

-vmargs

See also Eclipse Maven Plugin Configuration Problem

like image 161
Brimstedt Avatar answered Sep 21 '22 12:09

Brimstedt


I had exactly the same problem and end up adding the following dependency to the pom file:

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

This fixed the problem and made tools.jar available for QueryDSL plugin in my project. Hope this helps. Note, make sure that JDK version is used instead of JRE.

Edit: Recently noted that problem reappeared when I moved on new dev platform, in my case it was Ubuntu 12.10. The fix was to add ${JAVA_HOME}/bin to the $PATH

like image 20
pilot Avatar answered Sep 24 '22 12:09

pilot