Java Reference
In-Depth Information
aJava plug-in that implements Java 2 features. Applet tags in the web page can
initiate the downloading of the plug-in, but the plug-in file is large and users on
slow dial-up lines may refuse the download.
If your goal is to write applets for the broadest audience, then you need to
write code limited to version 1.1 classes and methods. The Supplements sections
in the Web Course provide alternative instruction in the 1.1 graphics techniques.
So far, Java maintains strict backwards compatibility . The bytecode from a
Java 1.0 compiler still runs in a Java 1.4 virtual machine. A program written
according to the Java 1.0 specification still compiles in a Java 1.4 compiler,
though the compiler will flag “deprecated” elements that are no longer considered
recommended practice.
Note, however, that you can in some cases run into problems if you mix code
from different versions within the same program. For example, the handling of
events , such as mouse clicks, changed significantly from version 1.0 to 1.1. A
program can use either event-handling approach but it cannot contain both.
1.8 Getting started
Yo u can quickly begin creating simple Java applets for the browser and applica-
tions for the console by following the code in the examples given here. Initially
youdonot need to understand all the elements of the language. We discuss the
meaning of terms such as class and extends in the following chapters. For
now it is important just to get the basic programming tools installed and learn
how to run them. The details will come later.
1.8.1 Setup for Java programming
To begin developing Java programs, follow these steps:
1. Obtain the Java 2 Software Development Kit (SDK) for your platform:
The SDK is available free from Sun Microsystems for Solaris, Linux, and Windows
platforms. See the Resources page in the Web Course for links to sites that provide
kits for alternate platforms as well as kits from non-Sun sources.
The SDK contains the essentials needed to create Java programs.
The SDK includes:
Java executables such as javac (compiler) and java (the JVM)
Class packages, which correspond to code libraries.
2. Install the SDK:
The Sun SDKs now come with an installer application that does most of the work
for you. Just run this program and follow its instructions.
3. Install the documentation:
It is recommended that you have ready access to the Java 2 API Specification since it
will be very useful during program development. If you use the Sun SDK, you should
Search WWH ::




Custom Search