There are three ways to distribute and run Java programs.
Each distribution method is slightly different and has its advantages and disadvantages. The OSP Collection distributes its programs primarily as compiled stand-alone Java applications. These application run like any other program if a Java Virtual Machine (VM) has been installed on the client computer's operating system. Running an OSP simulation as an application is simple and reliable because the program has complete access to local resources using file (security) permissions that are set by the user or by a local system administrator. The file containing the Java program is downloaded and placed in a directory on a local computer. Users should be able to double-click on the file to execute the program.
Other websites or curriculum developers may adopt a different distribution mechanism and additional pages in this section show how Open Source Physics programs can be distributed as applets and using Web Start.
A classical-physics model of helium consisting of two electrons in a 1/r potential well and interacting through a 1/r potential.
Example: Download the classical helium simulation and run the mech_helium.jar file. See an Introduction to Computer Simulation Methods by Harvey Gould, Jan Tobochnik and Wolfgang Christian Chapter 5 page 139 for a discussion of this model.
Ready to run OSP models are packaged in a Java archive (jar) file such as osp_demo.jar of osp_guide.jar. These jar files contain compiled code, resources such a images and data files, and a manifest containing startup instructions. Most operating systems with graphical user interfaces allow a user to double click on a jar file to execute the program whose name is specified in the jar's manifest.
Users may also execute a jar file from within a console (terminal) although it is unlikely that students will want to deal with the complexities of command-line syntax. For example, the osp_demo.jar file can be executed by entering:
java -jar osp_demo.jar
Although a jar file can contain many Java programs, only one program can be designated as the jar file's main program. This main program is specified in a text file within the jar known as a manifest. There are ways to override the manifest and thereby execute other programs within a jar but a more convenient approach is to use the Launcher program. Launcher is a Java program that is designed to execute (launch) other Java programs. We use Launcher to organize and distribute collections of ready-to-use programs, documentation, and curricular material in a single easily modifiable package. (See the Curriculum section for a more complete description of Launcher and Launch Builder.)
These resources provide computational models of physical systems. They are each focused on a very specific system and can be used for in-class or out-of-class demonstrations or exercises. They are meant to be building blocks for learning activities.