264Chapter9 • Platform Independent Development with Java
guage and if you are new to the language, you get help from many other
resources on the Internet as well as in print media. Some of the most pop-
ular include Sun Java SDK, IBM Java SDK, Kaffe, and
gcj
.
9.1How Java Applications Work
Java is a sort of interpreted language. Any program you write in Java is first compiled to generate
byte code. Depending upon type of output, the byte code may be in the form of a
Java application
or a
Java applet
. In the case of Java applications, you can directly invoke the Java virtual machine
to execute it. If the output type is an applet, it is usually loaded into a browser for execution.
9.1.1Java Compiler
The Java compiler is used to build Java applications or applets from source code files. In
most of the cases, the compiler is invoked as
javac
command. It also uses standard class librar-
ies that are usually part of the Java distributions.
9.1.2Java Virtual Machine
The purpose of the Java virtual machine is to execute Java code. In most cases, the virtual
machine is available as the command
java
. To run any application, you can just invoke the
java
command with the application name as the command line argument.
9.2Kaffe
Kaffe is one of the popular freely available implementations of the Java virtual machine. You
can download it from its web site http://www.kaffee.org. At the time of writing this book, ver-
sion 1.0.6 is available from the web site. I am using RedHat 7.1 for the development of this book
and this version is also part of the distribution. Most of the binaries are installed in
/usr/bin
directory. The following command displays version information for Kaffe:
[root@desktop Java]# java -version
Kaffe Virtual Machine
Copyright (c) 1996-2000
Transvirtual Technologies, Inc. All rights reserved
Engine: Just-in-time v3 Version: 1.0.6
Java Version: 1.1
[root@desktop Java]#
Note that the actual Kaffe Virtual machine is present as
/usr/bin/kaffe
and
/usr/
bin/java
is simply a shell script like the following to invoke Kaffe.
#! /bin/sh
# Pretend Kaffe is Java
prefix=/usr
exec_prefix=/usr
exec /usr/bin/kaffe ${1+"$@"}
Next Page >>
<< Previous Page
Back to the Table of Contents