gpt4 book ai didi

java - 设置类路径后包 org.apache.hadoop.conf 不存在

转载 作者:可可西里 更新时间:2023-11-01 14:13:43 27 4
gpt4 key购买 nike

我是 hadoop 的初学者,使用 hadoop 的初学者指南作为教程。

我使用的是 mac osx 10.9.2 和 hadoop 版本 1.2.1

当我在终端中调用 echo $PATH 时,我已经设置了所有适当的类路径:

这是我得到的结果:

/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/oladotunopasina/hadoop-1.2.1/hadoop-core-1.2.1.jar:/Users/oladotunopasina/hadoop-1.2.1/bin:/usr/share/grails/bin:/usr/share/groovy/bin:/Users/oladotunopasina/.rvm/gems/ruby-2.1.1/bin:/Users/oladotunopasina/.rvm/gems/ruby-2.1.1@global/bin:/Users/oladotunopasina/.rvm/rubies/ruby-2.1.1/bin:/usr/local/heroku/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/oladotunopasina/.rvm/bin:/Users/oladotunopasina/.rvm/bin

我尝试编译 WordCount1.java,但出现以下错误:

WordCount1.java:2: package org.apache.hadoop.conf does not exist
import org.apache.hadoop.conf.Configuration ;
^
WordCount1.java:3: package org.apache.hadoop.fs does not exist
import org.apache.hadoop.fs.Path;
^
WordCount1.java:4: package org.apache.hadoop.io does not exist
import org.apache.hadoop.io.IntWritable;
^
WordCount1.java:5: package org.apache.hadoop.io does not exist
import org.apache.hadoop.io.Text;
^
WordCount1.java:6: package org.apache.hadoop.mapreduce does not exist
import org.apache.hadoop.mapreduce.Job;
^
WordCount1.java:7: package org.apache.hadoop.mapreduce does not exist
import org.apache.hadoop.mapreduce.Mapper;
^

请帮忙。

最佳答案

CLASSPATH 变量是告诉应用程序(包括 JDK 工具 (javac))到哪里寻找用户类的方法。

您可以按如下所示设置此变量并尝试编译该类。

export CLASSPATH=$CLASSPATH:/Users/oladotunopasina/hadoop-1.2.1/hadoop-core-1.2.1.jar

关于java - 设置类路径后包 org.apache.hadoop.conf 不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24390492/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com