All Collections
Online IDE
Using the Sandbox
Using a .jar File in the Sandbox
Using a .jar File in the Sandbox

With the CodeHS IDE you can import existing .jar files into your Java Sandbox programs

Lea Sloan avatar
Written by Lea Sloan
Updated over a week ago

Using the CodeHS Sandbox, you can add existing Java Archive (.jar) files to your programs. Using .jar files can be useful to show a demo of a program without revealing the code or to import existing classes and other functionalities to your program. You can store programs or games into a single file and then import it to the CodeHS Sandbox.

To see how this works, check out this example Sandbox program: Battleship as Jar

Screenshot of a demo Java .jar file in the CodeHS Sandbox

The battleship.jar file that was imported contains the code for the Battleship game, but the students viewing the program will not be able to access this code.

One thing to note is that the .jar file needs to have been compiled using the same version of Java which runs on CodeHS, which is 1.8.0_222.

Video demonstration of using .jar in a Java Sandbox program:

Still have questions? Contact our team at to learn more!

Did this answer your question?