We Linux users all owe Scott McNealy and the folks at Sun Microsystems a round of applause for the development of Java. The write once, run anywhere feature of Java now makes it very easy for the developers of application software to let their users decide which operating system they will run the application on. I believe this wonderful new freedom that Java users now enjoy is the big reason why Bill "you know who" really doesn't like Java. For some of us, this adds an extra dimension of enjoyment to running Java applications.
In the course of my search for Linux aviation software, I discovered several packages of interest that were written in Java. To maximize the accessibility of these packages to other pilots, I decided it would be appropriate to include a very brief introduction to running Java software under Linux. As I really don't think it's a good idea to duplicate existing information, I will redirect you to other information resources for more advanced Java topics.
Java is an object oriented programming language developed by Sun Microsystems. It shares many similarities with the C++ language developed by AT&T. What makes Java unique is that it provides software developers with a write once, run anywhere capability. Java source code is compiled into a portable byte code rather than native instructions intended for a specific computer architecture. The byte code can then be executed on any system for which a Java Virtual Machine, or JVM is available. The JVM interpreter handles file io, graphics and so forth in a manner consistent with the given platform. The application developer does not need to be concerned with portability issues.
Although you may have to go to the extra effort involved with installing a JVM interpreter on your system, it's not really that difficult as you will see below. The JVM needs to be compliant with the version of the Java Application Programming Interface (API) associated with the software you want to run on it. At this time, most Java software uses the 1.1 level API. You may need to update your JVM periodically to remain compatible with the code you want run on it.
Java software comes in two different flavors, applets and applications. If you've done much surfing of the web, chances are good that you've executed an applet before. Applets are designed to be executed from within a Java capable web browser such as Netscape's Navigator or Communicator. When you point your browser to a web page that contains HTML tags that reference an applet, the browser transfers the applet code from the remote server to your local system and then executes the code. The JVM interpreter that executes the byte code is actually part of the web browser itself. For frequently used applets, you can transfer the HTML page(s) and the associated applet(s) to your system. Then you can direct your browser to the locally stored HTML page, eliminating the overhead associated with network transfers.
On the other hand, Java applications are designed to be installed on your local machine and executed using a stand alone JVM interpreter. They operate very much like a spread sheet, word processor, or similar application that was written in a language that is compiled into native code. The relevant point to remember is that the JVM interpreter you need to run a given Java software package will depend on if it is an applet or an application. The next section describes the various Java Virtual Machines available for Linux.
Running Java applets under Linux is relatively straight forward. The
easiest approach is to get a Java aware web browser. Right now the
only such browsers available for Linux are Netscape's Navigator and
Communicator. If you would rather not use a web browser there is another
option. Most JVM distributions for Linux contain an application called
appletviewer that can be used instead of a browser. You may want to
consider this later option if you have a low end machine (like my home
system :^). Netscape can take a long time to start up on such systems. Note
that the command line argument passed to your browser or
is the name of the HTML file that references the applet (not the
name of the applet).
To run a Java application under Linux you will need a stand alone JVM interpreter. Sun Microsystems provides several JVM products such as the Java Runtime Environment (JRE) which provides minimal runtime support, and the Java Developer's Kit (JDK) which also includes a Java compiler and other development tools. Sun supports these products on several UNIX systems, but does not support Linux as an official platform at this time. However, a group of volunteers called the Blackdown project have ported Sun's JVM to Linux under the terms of the Sun source code license agreement. The results of their work are freely available to all Linux users. They have done an excellent job, installation is easy, and a good FAQ is available from their site. Because Java technology is a rapidly moving target, the Blackdown JVM is your best bet in terms of compatibility with the Sun Java API. Unless disk space is an issue, get the JDK package and you will have everything you will ever likely need.
Another JVM interpreter for Linux is available from the Kaffe project. They have developed a freely distributable JVM (including source code) for Unix systems directly from the specifications. The latest version is of very high quality, I found it very easy to build and install. Red Hat users can download RPM packages directly from the Kaffe web site. To be honest, I did have some difficulty running some of the Java software described in this document under Kaffe. However, this is quite understandable since they are developing the JVM without using any Sun code (in their words, "a clean room implementation"). I am certain they will eventually reach their goal, and I am glad to see someone working on an implementation independent of Sun. This adds credibility to the notion that Java technology is open. You can help them reach their goal by reporting any difficulties you might experience. You can find the JVM interpreter discussed above at the following locations:
When running Java applications, the command line argument passed to your
JVM interpreter, such as
kaffe, is the name of the
class to be executed, not the name of a file. When running Java
applications, it is not uncommon for the interpreter to experience
difficulty locating the byte code for the classes it needs. When
this happens, use the
-verbose argument to instruct
the interpreter to print out more detailed information. This will
include information regarding the classes being loaded, and from what
directories. You may need to explicitly specify what directories are
to be searched for Java code by setting the
variable. It is a colon delimited list of directories or Jar files
(which are actually zip files) that contain Java code. Once you get
things figured out, you may want to write a small shell script to
simplify the process of starting the application.