在我的问题以复制方式结束之前:我已经查看了所有其他相关问题,但提供的解决方案对我不起作用,可能是因为我使用的是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.
更多推荐
发布评论