Steps To Run A JAVA API On Virtual-Box
Steps To Run A JAVA API On Virtual-Box
1. First, start the Virtual-Box on your machine. It is necessary to have Cloudera QuickStart
VM installed on your linux virtual machine. To do this, follow the steps in this video.
Download the ‘FileSystemOperationsTest.java’ file from here.
3. Create a new folder (Say ‘Test’) and move the file created in the first step to this folder.
4. Create another folder inside this folder (Say ‘test_classes’ inside the folder ‘Test’) to
store the Java classes.
5. Now open the terminal and type the following command:
export HADOOP_CLASSPATH=$(hadoop classpath)
6. Use the following command to check if the path has been set correctly:
echo $HADOOP_CLASSPATH
Please note that the command shown below is a single command and not three
different commands. The second line in the below command is the path of the classes
folder. Instead of typing the same, you may drag the folder and drop in the terminal.
Similarly, the third line below is the path of the ‘FileSystemOperationsTest.java’ file.
Instead of typing it, you may drag the file and drop it in the terminal.
As you can see the test.jar has been created which is highlighted in this image. Please do
verify the same. If the output is not the same as shown in the terminal, delete the jar file
created and re-run the command to create the jar file. Please be careful with the spaces
in the command.
10. Run this jar file on Hadoop using the following command:
Syntax:
hadoop jar <JAR_FILE> <CLASS_NAME>
hadoop jar test.jar FileSystemOperationsTest