Creating Hadoop with Eclipse / Maven - Missing jdk.tools:jdk.tools:jar:1.6 artifact

I am trying to import cloudera org.apache.hadoop: hadoop-client: 2.0.0-cdh4.0.0 from cdh4 maven repo in a maven project in eclipse 3.81, m2e plugin, with oracle jdk 1.7.0_05 on win7 using

<dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-client</artifactId> <version>2.0.0-cdh4.0.0</version> </dependency> 

however, I get the following error:

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

more specifically, maven claims the following artifact is missing

 Missing artifact jdk.tools:jdk.tools:jar:1.6 

How to solve this?

+64
java maven maven-2 hadoop cloudera
Jun 20 2018-12-12T00:
source share
12 answers

jdk.tools:jdk.tools (or com.sun:tools , or com.sun:tools you call it) is a JAR file that is distributed with the JDK. Usually you add it to maven projects as follows:

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

See Maven FAQ for adding dependencies to tools.jar

Or you can manually install tools.jar in a local repository using:

 mvn install:install-file -DgroupId=jdk.tools -DartifactId=jdk.tools -Dpackaging=jar -Dversion=1.6 -Dfile=tools.jar -DgeneratePom=true 

and then reference it as on Cloudera using:

 <dependency> <groupId>jdk.tools</groupId> <artifactId>jdk.tools</artifactId> <version>1.6</version> </dependency> 
+80
Jun 20 '12 at 11:01
source share

The problem is support for Eclipse Maven, the related question is here .

In Eclipse, the java.home variable java.home set to the JRE, which was used to run Eclipse, not to build the JRE. The default JRE system from C:\Program Files does not include the JDK, so tools.jar not found.

To fix the problem, you need to start Eclipse using the JRE from the JDK, adding something like this to eclipse.ini (before -vmargs !):

 -vm C:/<your_path_to_jdk170>/jre/bin/server/jvm.dll 

Then update the Maven dependencies (Alt-F5) (just updating the project is not enough).

+85
Apr 17 '14 at 9:35
source share

thanks npe adding

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

to pom.xml did the trick.

+30
Jun 20 '12 at 11:14
source share

This worked for me:

 dependency> <groupId>jdk.tools</groupId> <artifactId>jdk.tools</artifactId> <version>1.7.0_05</version> <scope>system</scope> <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath> </dependency> 
+6
Oct 22 '15 at 17:37
source share

If you can live without tools.jar, and it is included only as a related dependency, you can exclude it from an abusive project:

 <dependency> <groupId>org.apache.ambari</groupId> <artifactId>ambari-metrics-common</artifactId> <version>2.1.0.0</version> <exclusions> <exclusion> <artifactId>jdk.tools</artifactId> <groupId>jdk.tools</groupId> </exclusion> </exclusions> </dependency> 
+5
Sep 09 '16 at 18:32
source share

maybe install the jdk package to install, but maybe some development tools or a plugin.

I find this problem in openuse env. and I install java-1_6_0-openjdk-devel

the problem has not disappeared.

0
Mar 12 '14 at 3:18
source share

I also ran into this problem because I just installed the JRE not with the JDK . Thus, adding a dependency for jdk.tools cannot be fixed for me because tools.jar does not exist in my $ {JAVA_HOME} / lib / directory.

Now I downloaded and installed the JDK to fix it.

0
Nov 21 '14 at 3:18
source share

Change the set of installed JREs in your eclipse. Window> Settings> Java> Installed JREs, change the location of jre to% JAVA_HOME% / jre, but not something like C: \ Program Files \ Java \ jre7

0
Jan 23 '15 at 8:38
source share

If jdk.tools is present in the .m2 repository. However, you get an error something like this:

missing artifact: jdk.tools ..... c: ... / jre / ..

In the path buildpath -> configure build -> Libraries. Just change the JRE system library from JRE to JDK.

0
09 Oct '15 at 7:49
source share

I use below in my project mr.

 <exclusions> <exclusion> <artifactId>jdk.tools</artifactId> <groupId>jdk.tools</groupId> </exclusion> </exclusions> 
0
Apr 26 '16 at 22:44
source share

try:

mvn install: install-file -DgroupId = jdk.tools -DartifactId = jdk.tools -Dversion = 1.6 -Dpackaging = jar -Dfile = "C: \ Program Files \ Java \ jdk \ lib \ tools. jar"

also check: http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

0
Sep 18 '17 at 10:21 on
source share

Good if you use Windows

  • Go to C: \ Program Files \ Java \ jdk1.8.0_40 \ lib folder (the jdk version may be different for you)

  • Make sure tools.jar is present (otherwise download it)

  • Copy this path "C: \ Program Files \ Java \ jdk1.8.0_40"

  • In pom.xml

     <dependency> <groupId>jdk.tools</groupId> <artifactId>jdk.tools</artifactId> <version>1.8.0_40</version> <scope>system</scope> <systemPath>C:/Program Files/Java/jdk1.8.0_40/lib/tools.jar</systemPath> </dependency> 
  • Restore and run! BINGO!

-3
Jul 20 '15 at 12:34
source share



All Articles