无法找到或加载主类com.sun.tools.javac.Main hadoop mapreduce [英] Could not find or load main class com.sun.tools.javac.Main hadoop mapreduce

查看:437
本文介绍了无法找到或加载主类com.sun.tools.javac.Main hadoop mapreduce的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习MapReduce,但现在有点迷路了。

http://hadoop.apache.org/docs/r2.6.0/hadoop-mapreduce-客户端/ hadoop-mapreduce-client-core / MapReduceTutorial.html#使用情况



特别是这组指令:

 编译WordCount.java并创建一个jar:

$ bin / hadoop com.sun.tools.javac.Main WordCount.java

当我在终端输入 hadoop 时,我可以看到提供参数的帮助,所以我相信我已经安装了hadoop。



当我输入命令时:



编译WordCount.java并创建一个jar:



hadoop com.sun.tools.javac.Main WordCount.java



我得到错误:

错误:无法找到或加载主类com.sun.tools.javac.Main $ b

我知道我已经安装了Java并在我的计算机上工作,因为我之前使用它来创建其他程序。

这个命令输出:

$ $ $ $ usr / libexec / java_home
/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home

也许我错过了一套Java工具?不确定

解决方案

我得到了同样的错误。



我通过添加HADOOP_CLASSPATH环境参数解决了这个问题:

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

请确保你安装了OpenJDK7。我正在使用Ubuntu 14.04:

  sudo apt-get install openjdk-7-jdk 


I am trying to learn MapReduce but I am a little lost right now.

http://hadoop.apache.org/docs/r2.6.0/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html#Usage

Particularly this set of instructions:

Compile WordCount.java and create a jar:

$ bin/hadoop com.sun.tools.javac.Main WordCount.java 

When I type in hadoop in my terminal I am able to see the "Help" made which provides arguments so I believe I have hadoop installed.

When I type in the command:

Compile WordCount.java and create a jar:

hadoop com.sun.tools.javac.Main WordCount.java

I get the error:

Error: Could not find or load main class com.sun.tools.javac.Main

I know I have Java installed and working on my computer because I've used it before to create other programs.

This command outputs:

$ /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home

Maybe I am missing a set of Java tools? Not sure

解决方案

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

这篇关于无法找到或加载主类com.sun.tools.javac.Main hadoop mapreduce的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆