Hadoop:错误的执行编译 WordCount [英] Hadoop: bad execution compiling WordCount

查看:46
本文介绍了Hadoop:错误的执行编译 WordCount的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了 Hadoop 3.1.1 并且它正在运行.但是,当我尝试编译 WordCount 示例时,收到此错误:

I have installed Hadoop 3.1.1 and it is working. However, when I try to compile the WordCount example, I am receiving this error:

/usr/local/hadoop/libexec/hadoop-functions.sh: line 2358: HADOOP_COM.SUN.TOOLS.JAVAC.MAIN_USER: bad substitution
/usr/local/hadoop/libexec/hadoop-functions.sh: line 2453: HADOOP_COM.SUN.TOOLS.JAVAC.MAIN_OPTS: bad substitution

为了编译,我使用了下一行:

To compile, I used the next line:

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

我在 .bashrc 中有下一个变量:

I have the next variables in the .bashrc:

#Hadoop variables
export HADOOP_HOME=/usr/local/hadoop
export CONF=$HADOOP_HOME/etc/hadoop
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin

#Java home
export JAVA_HOME=${JAVA_HOME}/java-8-oracle

#Path Java Tools
export HADOOP_CLASSPATH=$JAVA_HOME/lib/tools.jar

这次我使用的是 Oracle 的 Java 8,因为 Ubuntu 18.08 LTS 的 apt-get 没有给我安装 OpenJDK8 的选项.我已经更新并升级了 Ubuntu.

This time I am using Java 8 of Oracle because the apt-get of Ubuntu 18.08 LTS does not give me the option of installing the OpenJDK8. I have updated and upgraded Ubuntu.

我已经阅读了很多不同的帖子和可能的解决方案,但我无法解决.

I have read a lot of different post and possible solutions, but I cannot solve it.

推荐答案

这是我在 https://janzhou.org/2014/how-to-compile-hadoop.html

设置 HADOOP_CLASSPATH:

Set the HADOOP_CLASSPATH:

export HADOOP_CLASSPATH=$(bin/hadoop classpath)

编译:

javac -classpath ${HADOOP_CLASSPATH} -d WordCount/ WordCount.java

这篇关于Hadoop:错误的执行编译 WordCount的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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