Web Analytics

About the Easy Java Simulation Tool


To create a computer simulation that describes a physical phenomenon from any field of physics, one needs considerable programming knowledge. This means that if someone is an expert in physics and wants to create a simulation to help study a specific physical phenomenon, they will need to spend a lot of additional time and effort to learn enough programming just to successfully create even a simple computer simulation.

The EJS (Easy Java Simulation) tool significantly simplifies the process of creating computer simulations, enabling physicists and others to develop simulations with only minimal programming knowledge.

Easy Java Simulation is an open-source program that is part of the Open Source Physics (OSP) project. It is developed in the Java programming language, as is its newer version, Easy JavaScript Simulation (EJSS), which allows for the creation of simulations in either Java or JavaScript.

This article will describe how to create JavaScript applets.

EJS was developed at the University of Murcia, Spain.

Programming with EJS is based on the MVC (Model-View-Controller) architecture, which is a standard approach in software architecture. It separates the visual part from the computational part and the data, as well as their management.

Installing EJS

EJS can be downloaded from the website EJS download

Download the latest stable version or an older one if needed. This tutorial uses the version EjsS_5.3_180211.zip, see the image below:

The zip archive should be extracted into a desired folder.

The extracted folder contains the following directories:

Here we can see the EjsConsole JAR file used to start EJS, and three folders. The most important one is the "workspace" folder, where the created simulations are stored. Contents of the workspace folder:

Within the "sources" folder, you should save simulations with the .ejs or .ejss extension, depending on whether you are creating Java or JavaScript simulations.

The "output" folder contains the generated simulations that will be used on websites. The program is started by clicking on the EjsConsole JAR file.

The Ejs console window has three tabs: Basic options (for general settings), Advanced options, and Output area. In the background, you can see that Ejs is running in this example, with Java selected as the programming language in the basic options.

In the basic options, you need to select the default virtual machine (i.e., Java JRE version), as well as the workspace and the programming language for simulations. By default, it is set to Java, but we will change it to JavaScript.

Even if Java is selected, you can still run the JavaScript version by clicking the "Launch Easy Java(script) Simulation" button. However, we will change the programming language to JavaScript so that the next time Ejs Console is started, EjsS will automatically launch for working with JavaScript simulations. After restarting Ejs Console, the EjsS application for creating simulations in JavaScript will launch:

© Copyright 2019 Slobodan Tršek