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
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
Video demonstration of using .jar in a Java Sandbox program:
Still have questions? Contact our team at email@example.com to learn more!