Going to School with Java
The Web includes numerous resources for educators and schoolchildren. Because Java programs can offer a more interactive experience than standard web pages, some programmers have used the language to write learning programs for the Internet.
For one such example, visit http://www.cs.ubc.ca/~van/sssjava to access a ski jump simulator created by Michiel van de Panne, a computer science professor at the University of British Columbia. The program uses Java to demonstrate physics-based animation as a skier tries several different slopes and jumps. The motion of the skier is controlled by moving a mouse one of eight directions, each of which affects the success of a jump. Figure 3.2 shows one run of the program right before my virtual skier met a gruesome end.
Figure 3.2. A ski-jump simulator can be experienced interactively on the Web using a Java program.
Numerous educational programs are available for many different operating systems, but one thing that makes this program stand out is its availability. The simulator is run directly from a web page. No special installation is needed, and, unlike most desktop software, it isn’t limited to a particular operating system. You can run Java programs on any computer that has a Java Virtual Machine (JVM).
The JVM loaded by a browser is the same one used to run the Saluton program during Hour 2, “Writing Your First Program.” A browser’s JVM only can run Java programs that are set up to run on web pages and cannot handle programs set up to run elsewhere, such as in a file folder.
The first browsers to support Java included a built-in JVM. Today, browsers support Java by relying on the Java Plug-in, a JVM that works as a browser enhancement.
A Java program, such as the ski-jump simulator, does not have to be written for a specific operating system. Because operating systems like Windows also are called platforms, this advantage is called platform independence. Java was created to work on multiple systems. Originally, Java’s developers believed it needed to be multiplatform because it would be used on a variety of appliances and other electronic devices.
Users can run the programs you write with Java on a variety of systems without requiring any extra work from you. Under the right circumstances, Java can remove the need to create specific versions of a program for different operating systems and devices.