I am trying to import cloudera's 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's 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 specific, maven states that the following artifact is missing
Missing artifact jdk.tools:jdk.tools:jar:1.6
How to solve this?
Change the set of installed JREs in your eclipse. Window > Preferences > Java > Installed JREs, change the location of jre to %JAVA_HOME%/jre, but not something like C:\Program Files\Java\jre7
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>
I use below in my MR project.
<exclusions>
<exclusion>
<artifactId>jdk.tools</artifactId>
<groupId>jdk.tools</groupId>
</exclusion>
</exclusions>
The problem is in the Eclipse Maven support, the related question is here.
Under Eclipse, the java.home
variable is set to the JRE that was used to start Eclipse, not the build JRE. The default system JRE from C:\Program Files
doesn't include the JDK so tools.jar
is not being found.
To fix the issue you need to start Eclipse using the JRE from the JDK by adding something like this to eclipse.ini
(before -vmargs
!):
-vm
C:/<your_path_to_jdk170>/jre/bin/server/jvm.dll
Then refresh the Maven dependencies (Alt-F5) (Just refreshing the project isn't sufficient).
If you can live without tools.jar and it's only included as a chained dependency, you can exclude it from the offending 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>
I also faced this problem because I just only installed JRE not with JDK. So , adding dependency for jdk.tools can't fix for me because tools.jar was not exist at my ${JAVA_HOME}/lib/ directory.
Now I downloaded and installed JDK to fix it.
Ok, if you are using Windows OS
Go to C:\Program Files\Java\jdk1.8.0_40\lib (jdk Version might 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>
Rebuild and run! BINGO!
maybe system install jdk package, but maybe some devel tools or plugin.
I find this problem under opensuse env. and I install java-1_6_0-openjdk-devel
the problem is disppeared..
thanks to 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.
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
If the jdk.tools is present in the .m2 repository. Still you get the error something like this:
missing artifact: jdk.tools.....c:.../jre/..
In the buildpath->configure build path-->Libraries.Just change JRE system library from JRE to JDK.
Source: Stackoverflow.com