About Java

Java is an computer language, developed by Sun microsystems. It has an object-oriented structure similar to C++.

The Java Virtual Machine

Java is semi-compiled, operating via a "java virtual machine" (JVM).

The original source code is written as plain text files (ending in .java). This must be compiled to java bytecode class files (ending in .class). These class files are then interpreted by the JVM.

Note many class files may also be packaged together in a "java archive" (.jar) file, which is compressed like zip to make it easy to send across the web.

The class files are the same for any type of computer, but the java virtual machine (JVM) is different and must be set up locally, as it converts java bytecode to raw machine code, and interacts with the operating system.

The JVM may be built into a web browser for running applets. Internet Explorer and Netscape provide their own JVMs, which differ between versions and platforms. It's also possible to use a JVM without a web browser (e.g. Sun JRE).

In theory, this JVM arrangement means you can "write once run anywhere", yet the calculations run much faster than directly interpreted languages such as basic or javascript.

The JVM also incorporates security checks which restrict what an applet loaded across the web can do -for instance it can't load or save files locally, only on the server from which it came. This makes it "safe" for applications in web browsers. Also, java was designed to make it easy to communicate across the web, with many networking and "internationalisation" features.

Why Use Java for this model?

Java is currently the *only* computer language which can both make big calculations efficiently, and draw vector graphics in a web browser (without plugins). Hence it is the only way to make a climate model working fast on the web (note interactive tools in other languages, require that the server sends a new graphic every time you change something, which is intrinsically much slower).

The modular "object oriented" structure is good for making an interactive graphical-user interface where the flow may jump about, and where components may be reused in different ways. However it takes a while to learn to construct a basic framework, before you can develop anything interesting.


  • The source code for Java Climate Model
  • Compiling java, basic syntax and simple applets