![]() |
Java is a programming language designed by Sun Microsystems and offers many benefits to the professional programmer and application developer. For example, 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. Java is much faster than interpreted languages (TCL, Perl, etc) 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. The Java Virtual Machine is at the heart of the Java programming language. In fact, you can't 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 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
javac converts Java source code (.java files) into ".class" files that contain the Java bytecode for the class. Example:
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.
Example:
This executes the Test.class bytecode compiled using the javac bytecode compiler (see above). The Java Virtual Machine installed on the servers 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, for example:
Example:
Running the toba command on Java bytecode will produce a native executable. In the example above, an "a.out" executable is produced. This executable can then be run just like other executables:
| |||||||
| ||||||||