Support Questions

Find answers, ask questions, and share your expertise

how to run a yarn jar in sandbox.

New Contributor


I am new to the sandbox. Trying to run a basic map-reduce function written in Java. I have already uploaded the data files in maria_dev user using Ambari files. I tried putting the jar file there only but didn't work. It showed Not a valid jar error.

I even tried to load the jar file using winscp. Logged in as root user and put the jar file in the tmp folder there. How can I access this jar file as I couldn't find the jar file in shell's tmp folder.


Super Mentor

@Shivam Aggarwal

As you are getting the message like "Not a valid jar" which mostly indicates a corrupted JAR issue.

The easiest way to verify if the JAR is corrupted or not is to run the following command to see if "jar" command is able to list it's content or not?

# $JAVA_HOME/bin/jar  -tvf   /path/to/your_jar.jar


If you see the same message while running the above jar command as well then it means your JAR is corrupt and you should get a correct JAR.

The other option is to compare the "md5sum" of the JAR in working and non working environment (to verify if these jars are bit by bit same or not)?


# md5sum  /path/to/your_jar.jar


Super Mentor

@Shivam Aggarwal

Regarding WinSCP issue. If your winscp has some issues then you can try using Ambari File View to upload the File to HDFS and then on the HDP sandbox terminal you can download the JAR file using following hdfs command:

Or use http://localhost:4200 (to login web terminal of your sandbox)

# ssh root@ -p 2222
Enter Password: hadoop

# su - hdfs -c  "hdfs dfs -get /your/jar/path/on/hdfs/your_jar.jar  /tmp


New Contributor

@Jay Kumar SenSharma

Thanks for the quick response. I tried the first method. I got the error shown in the attached screenshot. I have main function in the jar and the user has read, write and execute permission on the jar. I wanted to confirm if it's fine to keep the jar in tmp folder of the user maria_dev?

As for the second one, Ithe command worked fine but I jar-error.png couldn't find the jar in the /tmp folder of the hdfs user. Can you help me with the exact path where this jar has been copied?

New Contributor

You can keep the jar at container level.


1. Connect your container through WinSCP. Mostly SFTP root/<password>

2. You will see root. You can create a directory ex. mrbuild. then place the jar there.

3. Run the job

yarn jar mrbuild/mrapp1.jar VoteCountApplication /user/root/input /user/root/output


I hope it will help.