Falta tools-1.6.jar con Eclipse y 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?

El contenedor 'Dependencias de Maven' hace referencia a una biblioteca no existente C:\Users\sejohnson\.m2\repository\com\sun\tools\1.6\tools-1.6.jar

preguntado el 27 de agosto de 11 a las 20:08

your .pom? your .project and .classpath files? -

11 Respuestas

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.

Por ejemplo:

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

New line after -vm Es crucial.

it should be right above

-vmargs

Véase también Eclipse Maven Plugin Configuration Problem

contestado el 23 de mayo de 17 a las 15:05

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 de las personas acusadas injustamente llamadas $PATH

Respondido 11 Abr '13, 15:04

It could be that your eclipse is defaulting to your 32bit version of your jre. If you do everything right with JAVA_HOME set to C:\Program Files\Java\jdk1.6.0_21\bin and your running a 32bit version of eclipse you'll end up using something like C:\Program Files (x86)\Java\jre6\bin.

once you fix your jdk issue You will need to pass it on the end of a shortcut -vm "C:\Program Files (x86)\Java\jdk1.6.0_31\bin"

Or fix your JAVA_HOME

Other suggestions have been to make sure your eclipse is using the jdk not jre http://gamefromscratch.com/post/2011/11/15/Telling-Eclipse-to-use-the-JDK-instead-of-JRE.aspx

You'll find other post if you search tools.jar or playn another project with this common maven dependency issue.

Respondido 18 Abr '12, 08:04

I just encountered this issue, and pointing Eclipse to the JDK instead of the JRE fixed it for me. Thanks! - respirar

Can you check your pom.xml for dependencies around tools? A good source is mvnrepository.com, finally does your project compile outside of eclipse? Does mvn clean compile work in a dos box or shell? If it does maybe you just need to regenerate the eclipse project files with mvn eclipse:eclipse then refresh your project in eclipse

Respondido 28 ago 11, 00:08

Al tools.jar is not provided in any public repository (as I know). If your pom.xml references a file in your local repository you must install it by your own. The pom.xml you are using apparently expects that someone created/installed a tools-1.6.jar in an accecable Maven repository (e.g. to a company central maven repositiory manager like Nexus ).

If that does not fit for you try to change the dependency like explained in the Maven Preguntas Frecuentes.

Respondido 29 ago 11, 18:08

In addition to all the stated above, which could mean different steps to diagnose the problem and ultimately providing a proper solution, I'd first check in a command line (meaning, outside Eclipse runtime). Doing a plain 'mvn clean install' from a command line would give you the following:

  1. Certainty of whether you have the java executables correctly set (as they're the defaults used by all java apps, including of course eclipse,
  2. Certainty that your maven version does resolve the tools*.jar requirement via JDK provisioning adequately

Using these two facts you can rule out problems at Java installation and Maven installation levels. Then you can move on to making Eclipse use the same settings as you can use (JAVA JDK HOME, MAVEN HOME) in a command line, as the other answers above explain with good detail (specifically brimstedt's y josh's).

contestado el 23 de mayo de 17 a las 13:05

I had this same problem and it turned out that one of the dependencies in my POM file was transitively adding the dependency to the jdk.tools jar which I didn't need (and was causing the problems with the Eclipse Maven plugin). My solution was to exclude it from the problematic dependency like this:

<dependency>
  <groupId>it.unimi.di</groupId>
  <artifactId>mg4j-big</artifactId>
  <version>${mg4j-big.version}</version>
  <exclusions>
    <exclusion>
      <groupId>jdk.tools</groupId>
      <artifactId>jdk.tools</artifactId>
    </exclusion>
  </exclusions>
</dependency>

Try looking for the dependency that is transitively importing the jdk.tools jar and just exclude like I did above. This should solve your problem.

Respondido el 28 de junio de 17 a las 07:06

Thanks... I think that is the proper solution! Everything else are just workarounds or hacks. - Jonas

Having the same problem, I had to manually add the tools.jar in eclipse: Preferences -> Java -> Installed JREs -> Select jre -> Edit -> Add External JARs -> Find and select tools.jar -> Finish. Now it works.

Respondido 19 Feb 15, 15:02

Here is another option if you are having this build problem. I had the same build problem and i tried all of the above suggestions and the problem was still there. Then i noticed that my system path had the following "C:\ProgramData\Oracle\Java\javapath" as the first item.

I am not sure which program installed it. And when i checked the folder it only had some links ( short cuts). I removed this from the system path and the build error was resolved. Hope this helps someone else in the same situation.

contestado el 15 de mayo de 16 a las 20:05

Echo @Gopal Ramakrishnan. I had same problem in the env path (windows OS). It has "C:\ProgramData\Oracle\Java\javapath" in which has java.exe, thus impacted the actual jdk path when starting eclipse. Simply remove that resolved the problem. I am pretty sure the "C:\ProgramData\Oracle\Java\javapath" was quietly added by oracle "sql developer"...

Respondido 11 Jul 17, 05:07

In my case it turned out that I had this dependency in the pom.xml

<dependency>
            <groupId>com.sun</groupId>
            <artifactId>tools</artifactId>
            <version>1.6.0</version>
            <scope>system</scope>
            <systemPath>${env.JAVA_HOME}/lib/tools.jar</systemPath>
</dependency>

Sin embargo JAVA_HOME was set on startup of Eclipse to a JRE instead of a JDK.

So the tools.jar in fact did not exist for this reason

Respondido 06 Feb 18, 04:02

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.