Could not find or load main class com.sun.tools.javac.Main hadoop mapreduce

不想你离开。 提交于 2019-11-28 12:06:06

I got same error.

And i solved it by add HADOOP_CLASSPATH environment parameter:

export HADOOP_CLASSPATH=/usr/lib/jvm/java-7-openjdk-amd64/lib/tools.jar

Please make sure that you installed OpenJDK7. I am using Ubuntu 14.04:

sudo apt-get install openjdk-7-jdk
Mr. Z

The bin/hadoop com.sun.tools.javac.Main WordCount.java is finaly running as java com.sun.tools.javac.Main WordCount.java.

If your classpath/javahome is right, then try to type java ... yourself, and check the name com.sun.tools... by using TAB key. Maybe the name is not a proper one. (egg. you are using java from Oracle rather than SUN)

Another suggestion is modifying the $HADOOP_HOME/etc/hadoop/hadoop-env.sh. Add the tools.jar into HADOOP_CLASSPATH.

You may not install jdk. Check your /lib/tools.jar in your java folder.
If not, #sudo apt-get install default-jdk and the error disappears.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!