1) Write your MapReduce Program in a Text editor of your choice.
2) Place the source code (.java) file in any folder.
3) Compile the source using the following command:
javac -cp <path to hadoop client libraries> -d classes *.java
4) Create a jar file:
jar cvf sample.jar classes
5) Execute the jar file
hadoop jar sample.jar <fully qualified main class> <arg1> <arg2> ...
Alternatively, if you have Maven installed, then you can do the same by creating a Maven Project Structure from the Command Line, create a pom.xml and executemvn package
without worrying about external client libraries that Apache provides for Hadoop.
Follow the link for more details:https:
//maven.apache.org/guides/getting-started/maven-in-five-minutes.html