Java
Java
is a programming language created by
Sun Microsystems that
offers many benefits to professional programmers and
application developers. Java is a byte-compiled
language and is completely portable. You can execute the same
Java code (or Java class)
on a wide range of operating system platforms. Java is much
faster than interpreted languages (TCL, Perl, et al), 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. Web designers
can embed Java applets into their web content for display in Java-enabled
browsers like Netscape Navigator and Microsoft Internet Explorer.
The applets are
downloaded over the Internet within the context of the web
document and are then executed on the local computer. Applets
can add interactivity, animation, multimedia, or a database
interface to an otherwise dull and listless web site.
The Java Virtual Machine is at the heart of the Java programming
language. It is the engine that actually executes Java code.
You can't run a Java class or Java applet
without also running an implementation of the Java Virtual Machine.
When Java code is executed, the instructions are
not executed directly by the hardware of the local system. Instead
the Java Virtual Machine walks through the instructions
step by step and carries out the action the instruction represents.
This provides a level of protection
between your computer and the software you run on your computer.
Using Java on Your Virtual Server
There are several Java tools which are currently available on
your Virtual Server. The tools are compatible with version 1.0.2
of the Java spec. The 1.0.2 spec is supported by all Java
enabled browsers.
- javac - Java Bytecode Compiler
javac compiles Java source code (.java files) into .class files
that contain the Java bytecode for the class.
To compile an example file called Test.java, do something like this:
% javac Test.java
The resulting .class file can then be embedded into web content.
- java - Java Virtual Machine (Interpreter) and
"Just-In-Time" Compiler
The Java Virtual Machine is an interpreter for Java bytecode. To
execute the sample Test.class bytecode compiled using the
javac command above, do something like this:
% java Test
The Java Virtual Machine installed on the servers running FreeBSD is java_X 1.18.
The Java Virtual Machine installed on the servers running BSD/OS is Kaffe 0.84.
Kaffe version 0.91 (which is Java 1.1 compliant) is available as well.
The Java version 1.1 compliant interpreter can be executed using the
java1.1 command.
|
NOTE: If your Virtual Server was ordered after Nov 22, 1999, you are likely
running FreeBSD. To find out which O/S your Virtual Server is running, use the
uname command:
% uname
|
These Java Virtual Machines
also include a "Just-in-time" (JIT) code generator. JIT is a
technique for speeding up the execution of interpreted programs.
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.
|