简体   繁体   English

Maven从源代码安装Hadoop,查找tools.jar的错误路径

[英]Maven install Hadoop from source, looking in the wrong path for tools.jar

I am trying to build hadoop-2.4.0-src, using 'mvn clean install'. 我正在尝试使用'mvn clean install'构建hadoop-2.4.0-src。 About half of it completes successfully, but then the HDFS projetc fails with: 大约一半成功完成,但HDFS projetc失败了:

Exception in thread "main" java.lang.AssertionError: Missing tools.jar at: /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/Classes/classes.jar. Expression: file.exists()

....../Home/Classes/ does not exist, and tools.jar is in ......../Home/lib . ....../Home/Classes/不存在,tools.jar在......../Home/lib My $JAVA_HOME environment variable is definitely set correctly, and the JDK listed in the error message is correct - it's just looking in the wrong place within that path. 我的$JAVA_HOME环境变量肯定设置正确,错误消息中列出的JDK是正确的 - 它只是在该路径中查找错误的位置。 I have seen some postings that a common problem is that people are using the JRE and not the JDK, but I am certain that mine is the JDK. 我看到一些帖子,一个常见的问题是人们使用的是JRE而不是JDK,但我确信我的是JDK。

I have tried both suggestions from the accepted answer here: Buiding Hadoop with Eclipse / Maven - Missing artifact jdk.tools:jdk.tools:jar:1.6 我从接受的答案中尝试了两个建议: 用Eclipse / Maven建立Hadoop - 缺少工件jdk.tools:jdk.tools:jar:1.6

...with no success. ......没有成功。 Adding the 'dependency' block to Hadoop's pom.xml had no effect, and for the second suggestion I changed the relevant version numbers from 1.6 to 1.7. 将“依赖”块添加到Hadoop的pom.xml没有任何效果,对于第二个建议,我将相关版本号从1.6更改为1.7。 I have also tried various other suggestions from similar questions without success. 我也尝试过类似问题的各种其他建议而没有成功。

which returns what I expect: which将返回我的期望:

$ which javac
/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin/javac

However, the contents of JavaVM.framework/Versions seems strange to me, as it does not appear to list 1.7: 但是,JavaVM.framework / Versions的内容对我来说似乎很奇怪,因为它似乎没有列出1.7:

/System/Library/Frameworks/JavaVM.framework/Versions $ ls -al
total 64
drwxr-xr-x  11 root  wheel  374 May 10 11:05 ./
drwxr-xr-x  12 root  wheel  408 May 10 11:05 ../
lrwxr-xr-x   1 root  wheel   10 May 10 11:05 1.4@ -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10 May 10 11:05 1.4.2@ -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10 May 10 11:05 1.5@ -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10 May 10 11:05 1.5.0@ -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10 May 10 11:05 1.6@ -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10 May 10 11:05 1.6.0@ -> CurrentJDK
drwxr-xr-x   8 root  wheel  272 May 10 11:05 A/
lrwxr-xr-x   1 root  wheel    1 May 10 11:05 Current@ -> A
lrwxr-xr-x   1 root  wheel   59 May 10 11:05 CurrentJDK@ -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents

I am relatively new to Java, so I'm having trouble figuring out where the root of the problem is - is it my local directory tree, as shown by the odd contents of Versions ? 我对Java比较陌生,所以我无法弄清楚问题的根源在哪里 - 它是我的本地目录树,如Versions的奇怪内容所示? Is Java not configured correctly (although I have been using Java 1.7 in Eclipse for weeks now with no issues)? Java配置不正确(尽管我已经在Eclipse中使用Java 1.7几周了但没有问题)? Or is it an issue with Hadoop's pom.xml I need to update somehow? 或者它是Hadoop的pom.xml的问题我需要以某种方式更新?

Thanks for any help. 谢谢你的帮助。

Ran the following to solve the issue on my mac: 如下解决我的mac上的问题:

cd /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/ 
sudo mkdir Classes 
cd Classes/ 
sudo ln -s ../jre/lib/rt.jar classes.jar

Ref: http://ilovemylinux.blogspot.com/2013/05/maven-jspc-compile-error-with-java-7-on.html 参考: http//ilovemylinux.blogspot.com/2013/05/maven-jspc-compile-error-with-java-7-on.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM