|
Java is a programming
language designed by Sun Microsystems and offers many
benefits to the professional programmer and application
developer. Java is a byte-compiled language and is completely
portable. You can run the same Java binary (or Java
class as it is more correctly termed) on a wide range
of operating system platforms. In certain circumstances,
Java is much faster than interpreted languages (e.g.
TCL, Perl) but cannot run as fast as fully compiled
languages (C, C++).
Because of its portability,
Java and the World Wide Web make an excellent match.
With a Java-enabled browser, web designers can embed
applets into their web content. The applets are downloaded
over the Internet with the context of the web document
and are then executed on the local computer. Applets
can add interactivity, animations, multimedia, or database
interfaces to an otherwise dull and listless web site.
Programming with the
Java Virtual Machine
The Java Virtual Machine
is at the heart of the Java programming language. In
fact, you cannot run a Java class or Java applet without
also running an implementation of the Java Virtual Machine.
For example, both the browsers Netscape and MSIE include
an implementation of the Java Virtual Machine (usually
referred to as a Java runtime system).
The Java Virtual Machine
is the engine that actually executes a Java program.
When a Java program is run, the instructions are not
executed directly by the hardware of the local system,
instead an interpreter or "virtual processor"
walks through the instructions step by step and carries
out the action the instruction represents. This may
seem abstract, but it actually provides a level of protection
between your computer and the software you run on your
computer. With a Java Virtual Machine, it is very easy
to insert protections that prevent a program from performing
malicious acts, such as deleting files on your disk
or corrupting memory.
Using Java on Your Virtual Server
There are several Java
tools that are currently available on your Virtual Server.
The tools are compatible with version 1.0.2 of the Java
specification. The 1.0.2 specification is supported
by all Java-enabled browsers. The following is a list
of the Java tools included on your Virtual Server:
- javac - Java
Bytecode Compiler
- java - Java
Virtual Machine (interpreter) and "just-in-time"
Compiler
Java Bytecode Compiler
(javac)javac converts
Java source code (.java files) into .class
files that contain the Java bytecode for the class.
For example:
% javac Test.java
Where Test.java
is a Java source code file. The resulting class file
can then be embedded into web content. If you have a
Java-enabled browser, you can check out the example
applet yourself.
Java Virtual Machine
(Interpreter) and "Just-in-Time" Compiler
(java)The Java Virtual Machine
is an interpreter for Java bytecode. This also includes
a "Just-In-Time" (JIT) code generator. JIT
is a technique for speeding up the execution of interpreted
programs. The idea is that, just before a method is
run for the first time, the machine-independent Java
bytecode for the method is converted into native machine
code. This native machine code can then be executed
by the computer directly, rather than via interpreter.
JIT code generator greatly increases the speed of interpreted
bytecode to nearly the speed of compiled code. For example:
% java Test
This executes the Test.class
bytecode compiled with the javac bytecode compiler
(see above).
The Java Virtual Machine
installed on the servers is java_x 1.18.Kaffe 0.84.
|