Hadoop“无法找到或加载主类com.sun.tools.javac.Main”(Hadoop “Could not find or load main class com.sun.tools.ja

编程入门 行业动态 更新时间:2024-10-25 16:16:56
Hadoop“无法找到或加载主类com.sun.tools.javac.Main”(Hadoop “Could not find or load main class com.sun.tools.javac.Main”)

在我的问题以复制方式结束之前:我已经查看了所有其他相关问题,但提供的解决方案对我不起作用,可能是因为我使用的是Cygwin,而不是Unix。

我正在尝试这里的tuturial。 每当我运行命令(在c:/ hadoop中) bin/hadoop com.sun.tools.javac.Main WordCount.java ,我收到错误Could not find or load main class com.sun.tools.javac.Main 。

我的Java_Home变量设置为: c:/PROGRA~1/Java/jdk1.7.0_17 ( echo $JAVA_HOME确认这一点),我的HADOOP_CLASSPATH为c:/PROGRA~1/Java/jdk1.7.0_17/lib/tools.jar 。

javac -version确认我正在使用jdk1.7.0_17。

谁会知道可能是什么问题?

Before my question is closed as a duplicate: I have looked at all other related questions but the solutions provided don't work for me, probably because I'm using Cygwin, not Unix.

I'm trying out the tuturial here. Whenever I run the command (while in c:/hadoop) bin/hadoop com.sun.tools.javac.Main WordCount.java, I get the error Could not find or load main class com.sun.tools.javac.Main.

My Java_Home variable is set to: c:/PROGRA~1/Java/jdk1.7.0_17 (echo $JAVA_HOME confirms this), and my HADOOP_CLASSPATH to c:/PROGRA~1/Java/jdk1.7.0_17/lib/tools.jar.

javac -version confirms that I'm using jdk1.7.0_17.

Would anyone know what could be the issue?

最满意答案

Windows和Unix / Linux工具之间的区别之一是处理PATH和CLASSPATH变量,在Windows中,为了支持C:\...路径表示法, PATH和CLASSPATH中的分隔符是分号; 在Linux上,其中:在文件路径中非常罕见,分隔符为: 。

当你在cygwin上运行时,你正在使用Unix / Linux版本的Hadoop(也可能是Java)。 这意味着它可能期望CLASSPATH被冒号(:)分隔。

所以你应该使用你给出的路径的“Unix”版本,在cygwin中可以通过用/cygdrive/c替换c:获得。

One of the differences between Windows and Unix/Linux tools is the handling of PATH and CLASSPATH variables, where in Windows, to support the C:\... path notation, the delimiter in PATH and CLASSPATH is a semicolon ;, and on Linux, where : in file paths is very rare, the delimiter is :.

As you are running on cygwin, you are using the Unix/Linux version of Hadoop (and probably Java as well). This means it is probably expecting CLASSPATH to be colon (:) delimited.

So you should use the "Unix" version of the path you have given, which in cygwin is available by replacing the c: with /cygdrive/c.

更多推荐

本文发布于:2023-08-05 00:45:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1424616.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:加载   tools   javac   Hadoop   sun

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!