知识点
相关文章
更多最近更新
更多Hadoop编译WordCount程序:class file for org.apache.commons.cli.Options no
2019-03-28 13:11|来源: 网络
Hadoop问题:编译WordCount程序报错:class file for org.apache.commons.cli.Optio
第一次编译Hadoop的程序,将安装程序自带的WordCount程序拿出来编译执行,编译时遇到如下错误:
Ubuntu@ubuntu:~/dev/wordcount$ javac -classpath /home/ubuntu/hadoop-1.0.4/hadoop-core-1.0.4.jar -d bin WordCount.java
WordCount.java:53: cannot access org.apache.commons.cli.Options
class file for org.apache.commons.cli.Options not found
String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
^
1 error
在网上搜索了一下,找到了原因,在 classpath 中再加上一个 jar 包即可:
ubuntu@ubuntu:~/dev/wordcount$ javac -classpath /home/ubuntu/hadoop-1.0.4/hadoop-core-1.0.4.jar:/home/ubuntu/hadoop-1.0.4/lib/commons-cli-1.2.jar -d bin WordCount.java
ubuntu@ubuntu:~/dev/wordcount$ ls bin/*.class
bin/WordCount.class bin/WordCount$IntSumReducer.class bin/WordCount$TokenizerMapper.class
相关问答
更多-
您正在使用org.apache.commons.math3.distribution因此您需要在类路径中使用apache math lib。 谢谢 :) You are using the org.apache.commons.math3.distribution so you would need the apache math lib in your classpath. Thanks :)
-
您必须在两者中设置类路径 编译过程(javac)和 运行时(java) 看到一个类似的话题 。 You must set a classpath in both compile process (javac) and runtime (java) see a similar topic.
-
在Hadoop中,您处理输入拆分而不是块。 输入拆分是完整的数据集。 您希望避免一个映射器超过两个拆分的情况,因为这会降低性能并创建流量。 在文本世界中,假设您在block1中并且您有一个句子,例如“我是一个哈”,而block2继续“doop developer”,那么这会创建网络流量,因为我们始终必须在一个完整的节点上工作输入拆分和一些数据必须转移到另一个节点。 In Hadoop you work on input splits and not on blocks. An input split is ...
-
删除已存在的输出文件,或输出到不同的文件。 (我有点好奇你对错误信息的其他解释。) Delete the output file that already exists, or output to a different file. (I'm a little curious what other interpretations of the error message you considered.)
-
您需要将commons-beanutils工件添加到您的库中的Dependencies中以解决此问题。 所以你的sbt文件的libraryDependencies关系如下所示。 libraryDependencies ++= Seq( "org.apache.spark" %% "spark-core" % "2.1.0", "com.databricks" %% "spark-csv" % "1.5.0", "org.apache.commons" % "commons-configurati ...
-
在Windows中的eclipse中调试hadoop Wordcount程序(Debugging hadoop Wordcount program in eclipse in windows)[2022-04-11]
我怀疑Hadoop是否安装正确。 如果所有守护程序都在运行,请检查您的机器。如果没有,请考虑重新检查或重新安装您缺少的内容。 ERROR [main] util.Shell (Shell.java:getWinUtilsPath(373)) - Failed to locate the winutils binary in the hadoop binary path java.io.IOException: Could not locate executable I doubt if Hadoop ... -
如何在apache commons-cli中使用CommandLine和Options(how to use CommandLine and Options in apache commons-cli)[2022-04-23]
这是我使用的一个非常简化的版本。 它基本上设置了一个初始化一次的单例,然后可以在程序中的任何地方使用。 我选择将信息存储在HashMap和ArrayList中,因为它们以后更容易处理。 //**************************************************************************** //***** File Name: MianCLIOptions.java //******************************************* ... -
我无法重现。 将JAR文件添加到依赖项并在类文件之上添加import语句后,一切都按预期工作。 也许试着改变scope ? 依赖关系: 班级档案: I cannot reproduce. After adding JAR file to dependencies and adding an import statement on top of the class file everything worked as expected. Maybe try to change scope? Dependenci ...
-
Commons Math - 找不到类org.apache.commons(Commons Math - could not find class org.apache.commons)[2022-07-01]
在构建配置中,确保检查要在“订购和导出”中导出的库。 看到 In your Build Configuration, make sure you check your library to be exported in Order and Export. See -
根据文档,您可以执行以下操作(在我的系统和工作中测试) export HADOOP_CLASSPATH=${JAVA_HOME}/lib/tools.jar $HADOOP_HOME/bin/hadoop com.sun.tools.javac.Main WordCount.java并最终使用jar创建 jar cf wc.jar WordCount*.class 链接到这里的官方文档 According to the documentation you can do the following (test ...