How can I run Hadoop run with a Java class?

前端 未结 9 813
甜味超标
甜味超标 2021-01-20 03:13

I am following the book Hadoop: the definitive Guide.

I am confused on example 3-1.

There is a Java source file, URLCat.java. I use javac to co

9条回答
  •  情话喂你
    2021-01-20 03:49

    Not sure how Useful is the answer now. I faced the same issue today in fact working on an example from the same book (Hadoop definitive guide) I was able to execute an example program as follows:

    • Write your java code and save it as .java file

    • Compile your java program using:

      javac -classpath  
      
    • Create a jar file containing your class file:

      jar cvf  
      
    • Execute the jar file using hadoop command line:

      hadoop jar   
      

      e.g.

      hadoop jar FileSystemCat.jar FileSystemCat hdfs://localhost/user/root/MyFiles/meet_a_seer.txt
      

    Hope it helps

提交回复
热议问题