APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.



The Open Source Physics Project develops simulations in two programming languages:

  • Java: A high-level programming language that was originally designed and developed by Sun Microsystems for embedded devices (such as set-top boxes) but later became a popular choice for creating desktop and server web applications. Java is a strictly typed object-oriented programming language with a syntax similar to C++. Unlike Windows or Macintosh applications, Java programs are not compiled into programs that run directly within a computer operating system. Instead, Java programs are compiled into platform independent code that is then run by a Java Virtual Machine (JVM), which is available on multiple platforms.
  • JavaScript: A client side programming language commonly used in web development. While JavaScript was influenced by Java and has some syntactic similarities, it has a fundamentally different architecture because variables are not strongly typed and code is not compiled but processed (interpreted) by the client's web browser rather than on the web server. JavaScript in combination with HTML5 has become the de facto standard for web page development.

Both languages allow us to develop simulations that run on any platform (Microsoft, Apple, and Unix) thereby encouraging wide distribution and adoption. Both languages are likely to be available and widely used for the foreseeable future because they are mature industry-standards in e-commerce.

We initially choose Java because it allowed us to develop and distribute applet-based simulations develop applet-based curricular material that would run on any desktop operating system using a web browser. Unfortunate, security concerns and the rise of mobile devices without Java support ended the promise of using a single programming language to desktop and browser-based simulations. Fortunately, JavaScript together with HMTL5 has fulfilled the promise of being a universal curriculum development platform.

Java continues to be widely used in education and industry because it is faster than JavaScript and allows the same code to be run on Microsoft, Apple, and Unix desktop computers and servers. The OSP project continues to support Java because OSP applications, such as the Tracker video analysis tool and the Easy Java Simulations programming and authoring tool are written in Java. The OSP Collection hosts and distributes many Java programs and we are now able to convert Java to JavaScript code.

Ready-to-Use JavaScript Simulations

Solar and Lunar Eclipse item.
The Solar and Lunar Eclipse JavaScript model in ComPADRE.

Open Source Physics JavaScript models are distributed as downloadable html pages, as ready-to-run html pages, and (sometimes) as an app or EPub for mobile devices. The main item is usually a zip file that can be downloaded to run locally on a computer or web server. For ease of use, there are one or more icons to immediately run the simulation. Clicking the EJS Model icon runs the web that was created by the Easy Java/JavaScript Simulations authoring tool that was used to create the simulation. Clicking the OSP-PWA icon runs a version of the simulation has been modified to download as a Progressive Web App (PWA) –- a special type of web page that is delivered through from a secure server to a browser, that can work off-line, and that can be installed on a user's home screen. Note that the Solar and Lunar Eclipse simulation is also available as a downloadable Android app and that it has a worksheet.

Search for an OSP JavaScript Simulation or browse by topic

Example: Search for "Solar Eclipse" the Solar and Lunar Eclipse JavaScript Model. Run the default web page and PWA on a desktop computer. Google Chrome is recommended for the PWA on computers and Android devices, but Safari must be used on iOS devices if to install the simulation on the iOS home screen.

Ready-to-Use Java Simulations

Java programs are run using a Java virtual machine (JVM) that enables a desktop computer to run compiled Java code, known as (bytecode).  JVMs are available from various vendors (Oracle, Red Hat, Google and open source) for all major operating system (Windows, OS X, and Unix) but a JVM must usually be installed by the end-user before a Java program can be run. Y0u can install either the Java runtime (JRE) or the more complete Java Development kit (DK). The JDK includes the JRE.

A classical-physics model of helium consisting of two electrons in a 1/r potential well and interacting through a 1/r potential.

Ready to run OSP programs are packaged in a Java archive (jar) file such as osp_demo.jar or osp_guide.jar. These jar files contain compiled Java code, resources such a images and data files, and a manifest containing start up instructions. Most operating systems with graphical user interfaces allow a user to double click on a jar file to execute the program if a JRE is installed.

Search for an OSP Java Simulation or browse by topic

Example: Search for helium and download the classical helium simulation, mech_helium.jar file. Run this simulation. See an Introduction to Computer Simulation Methods by Harvey Gould, Jan Tobochnik and Wolfgang Christian Chapter 5 page 139 for a discussion of the physics.

Users may also execute a jar file by typing a command in 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.

The OSP Network:
Open Source Physics - Tracker - EJS Modeling
Physlet Physics
Physlet Quantum Physics