Java Reference
In-Depth Information
A Java compiler converts the Java sourcecode that you write into a binary program consisting of byte
codes . Byte codes are machine instructions for the Java virtual machine. When you execute a Java
program, a program called the Java interpreter inspects and deciphers the byte codes for it, checks it
out to ensure that it has not been tampered with and is safe to execute, and then executes the actions
that the byte codes specify within the Java virtual machine. A Java interpreter can run standalone, or it
can be part of a web browser such as Netscape Navigator or Microsoft Internet Explorer where it can be
invoked automatically to run applets in a web page.
Because your Java program consists of byte codes rather than native machine instructions, it is
completely insulated from the particular hardware on which it is run. Any computer that has the Java
environment implemented will handle your program as well as any other, and because the Java
interpreter sits between your program and the physical machine, it can prevent unauthorized actions in
the program from being executed.
In the past there has been a penalty for all this flexibility and protection in the speed of execution of
your Java programs. An interpreted Java program would typically run at only one tenth of the speed of
an equivalent program using native machine instructions. With present Java machine implementations,
much of the performance penalty has been eliminated, and in programs that are not computation
intensive - which is usually the case with the sort of program you would want to include in a web page,
for example - you really wouldn't notice this anyway. With the JVM that is supplied with the current
Java 2 System Development Kit (SDK) available from the Sun web site, there are very few
circumstances where you will notice any appreciable degradation in performance compared to a
program compiled to native machine code.
Java Program Development
There are a number of excellent professional Java program development environments available,
including products from Sun, Borland and Symantec. These all provide very friendly environments for
creating and editing your sourcecode, and compiling and debugging your programs. These are powerful
tools for the experienced programmer, but for learning Java using this topic, I recommend that you
resist the temptation to use any of these, especially if you are relatively new to programming. Instead,
stick to using the Java 2 SDK from Sun together with a suitable simple editor for creating your
sourcecode. The professional development systems tend to hide a lot of things you need to understand,
and also introduce complexity that you really are better off without while you are learning. These
products are intended primarily for knowledgeable and experienced programmers, so start with one
when you get to the end of the topic.
You can download the SDK from Sun for a variety of hardware platforms and operating systems, either
directly from the Sun Java web site at http://java.sun.com (for Windows, Solaris, and Linux operating
systems), or from sites that you can link to from there. The SDK we are going to use is available from
http://java.sun.com/j2se/1.4. For instance a version of the SDK for Mac OS is available from
http://devworld.apple.com/java/ .
There is one aspect of terminology that sometimes causes confusion - the SDK used to be known as the
JDK - the Java Development kit. If you see JDK this generally means the same as SDK. When you
install the Java 2 SDK, you will see the old terminology survives in the name of the root directory where
the SDK is installed, currently /jdk1.4.
Search WWH ::




Custom Search