简体   繁体   English

在Linux上使用类路径运行Javac Command

[英]Running Javac Command with classpath on linux

I have a folder Called TutorialFolder. 我有一个名为TutorialFolder的文件夹。 Inside this, i have tutorial_class folder and WordCount.java file. 在其中,我有tutorial_class文件夹和WordCount.java文件。 When I run wordcount program, it is giving below error. 当我运行wordcount程序时,它给出以下错误。

hduser@ubuntu:~/Desktop/TutorialFolder$ javac -classpath ${HADOOP_CLASSPATH}-d '/home/hduser/Desktop/TutorialFolder/tutorial_class' '/home/hduser/Desktop/TutorialFolder/WordCount.java' 
javac: invalid flag: /home/hduser/Desktop/TutorialFolder/tutorial_class
Usage: javac <options> <source files>
use -help for a list of possible options

The problem here is with the variable ${HADOOP_CLASSPATH} which is not set or empty. 这里的问题是变量${HADOOP_CLASSPATH}没有设置或为空。 Thus the command is interpreted as, 因此,该命令被解释为:

javac -classpath  -d /home/hduser/Desktop/TutorialFolder/tutorial_class /home/hduser/Desktop/TutorialFolder/WordCount.java 

Fix the $HADOOP_CLASSPATH variable, the command should work. 修复$HADOOP_CLASSPATH变量,该命令应该起作用。

Or, Try with hadoop classpath command 或者,尝试使用hadoop classpath命令

javac -classpath `hadoop classpath` -d /home/hduser/Desktop/TutorialFolder/tutorial_class /home/hduser/Desktop/TutorialFolder/WordCount.java 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM