Sidebar: The Java Environment
The Java environment was developed by Sun Microsystems,
originally for
another context. The Java language is object oriented,
so you can write
programs that inherit their intelligence from other
programs or class
libraries. This means you can reuse the things that
you wrote before.
The strength of the Java language is that it offers
you the power of an
object-oriented language, but is much simpler to use
than, for example,
C++. The main advantage of Java's simplicity is that
it can be run in a
simple environment, such as a web browser.
The reason that Java found such a strong foothold in
the Web community
stems from the fact that it compiles to an architecture-independent
virtual machine. This means Java programs are compiled,
not to the
native machine code of the development platform, but
to the machine code
of a virtual machine. When a Java program is run, its
virtual machine
code is interpreted by the Java interpreter on the machine
on which the
program is running. This concept allows you to develop
your Java
programs on one machine, and run them on a great number
of other
different (or similar) machines without recompiling
or even relinking.
Furthermore, the Java language is multithreaded. So,
you can write
programs with more than one execution thread. This can
be very
convenient, especially in user interface programs that
usually contain a
number of execution threads. One of these threads can
wait for input
from the user, while the other ones try to manipulate
the data from the
server. The Java interpreter also does its own garbage
collection, so a
developer does not have to bother about that. Garbage
collection can
cause of a lot of trouble if it must be done by the
program itself. And
finally, the Java interpreter is small and robust. It
has a small system
footprint and, according to its makers, cannot crash
your computer
system.
A hot item for the Java language is security. Java was
designed to be
secure (the interpreter even checks all instructions
before executing),
but as of this writing, a number of security holes have
been detected
with Java-enabled browsers. These security holes enabled
the server
(which runs on a machine on the evil Internet) to load
files from the
machine on which the browser is running. So, you should
disable the Java
features if you plan to access the Internet. If you
remain on your local
network, and you want to use the Java features in your
GUI, then you
should enable Java in your browser.
Besides the Java interpreter, the Java environment also
consists of a
number of object class libraries used by the different
Java programs (or
applets). A number of standard class libraries is available,
here is a
short compilation:
java.lang--General language class, contains things like Object, String.
java.util--Contains (hopefully) useful classes like Hashtable and Vector
java.io--Streams-based input and output
java.net--Network related classes, give access to TCP/IP-based communications
java.awt--Abstract Window Toolkit, especially for graphical user interfaces
java.applet--Applet enabling functions, required when writing an WWW applet
You can use one or more of these class libraries in
your own applets.
They are general application libraries with a lot of
useful objects.
|