简体   繁体   中英

Hadoop “Could not find or load main class com.sun.tools.javac.Main”

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?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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