java—在Hadoop2.4.0中找不到org.apache.hadoop.conf的lib

taor4pac  于 2021-06-04  发布在  Hadoop
关注(0)|答案(1)|浏览(409)

我一直在研究hadoop-2.4.0,为了运行基于java的hadoop示例,我在类路径上放置了所需的lib

export HADOOP_HOME= /root/hadoop-binaries/hadoop-2.4.0    
CLASSPATH=/root/hadoop-binaries/hadoop-2.4.0/conf
CLASSPATH=$CLASSPATH:$HADOOP_HOME/*:$HADOOP_HOME/lib/*
CLASSPATH=$CLASSPATH:$HADOOP_HOME/../hadoop-mapreduce/*
CLASSPATH=$CLASSPATH:$HADOOP_HOME/../hadoop-mapreduce/lib/*
CLASSPATH=$CLASSPATH:$HADOOP_HOME/../hadoop-yarn/*
CLASSPATH=$CLASSPATH:$HADOOP_HOME/../hadoop-yarn/lib/*
CLASSPATH=$CLASSPATH:$HADOOP_HOME/../hadoop-hdfs/*
CLASSPATH=$CLASSPATH:$HADOOP_HOME/../hadoop-hdfs/lib/*
CLASSPATH=$CLASSPATH:$HADOOP_HOME/../common/*
CLASSPATH=$CLASSPATH:$HADOOP_HOME/../common/lib/*
CLASSPATH=$CLASSPATH:$HADOOP_HOME/../tools/lib/*

我已经将所有需要的hadoop库从hadoop\u主页添加到类路径中。
但是,当我尝试运行示例javac-cp$classpath helloworld.java时
它提醒我一个错误

HelloWorld.java:4: error: package org.apache.hadoop.conf does not exist
import org.apache.hadoop.conf.Configuration;                                 ^
1 error

我不知道在哪里可以找到org.apache.hadoop.conf的lib。

wkftcu5l

wkftcu5l1#

试试这些
打印类路径
回显$classpath
“导出”中有空间
导出hadoop\u home=“space”/root/hadoop二进制文件/hadoop-2.4.0
希望有帮助

相关问题