Core Java course
Installing the Java Development Kit
The most complete and up-to-date versions of the Java 2 Standard Edition (J2SE) are available from Sun Microsystems for Solaris, Linux, and Windows. Versions in various states of development exist for the Macintosh and many other platforms, but those versions are licensed and distributed by the vendors of those platforms.
Downloading the JDK
To download the Java Development Kit, you will need to navigate the Sun web site and decipher an amazing amount of jargon before you can get the software that you need.
You already saw the abbreviation JDK for Java Development Kit. Somewhat confusingly, versions 1.2 through 1.4 of the kit were known as the Java SDK (Software Development Kit). You will still find occasional references to the old term.
Next, you'll see the term "J2SE" everywhere. That is the "Java 2 Standard Edition," in contrast to J2EE (Java 2 Enterprise Edition) and J2ME (Java 2 Micro Edition).
The term "Java 2" was coined in 1998 when the marketing folks at Sun felt that a fractional version number increment did not properly communicate the momentous advances of JDK 1.2. However, because they had that insight only after the release, they decided to keep the version number 1.2 for the development kit. Subsequent releases were numbered 1.3, 1.4, and 5.0. The platform, however, was renamed from "Java" to "Java 2." Thus, we have Java 2 Standard Edition Development Kit version 5.0, or J2SE 5.0.
The documentation is contained in a compressed file that is separate from the JDK. You can download the documentation. Several formats (.zip, .gz, and .Z) are available. Choose the format that works best for you. If in doubt, use the zip file because you can uncompress it with the jar program that is a part of the JDK. Simply follow these steps:
1. Make sure that the JDK is installed and that the jdk/bin directory is on the execution path.
2. Download the documentation zip file and move it into the jdk directory. The file is called j2sdkversion-doc.zip, where version is something like 5_0.
3. Open a shell window.
4. Change to the jdk directory.
5. Execute the command
jar xvf j2sdkversion-doc.zip
Choosing a Development Environment
If your programming experience comes from using Microsoft Visual Studio, you are accustomed to a development environment with a built-in text editor and menus to compile and launch a program along with an integrated debugger. The basic JDK contains nothing even remotely similar. You do everything by typing in commands in a shell window. We tell you how to install and use the basic JDK because we have found that the full-fledged development environments don't necessarily make it easy to learn Java—they can be complex and they hide some of the interesting and important details from the programmer.
Integrated development environments tend to be more cumbersome to use for a simple program because they are slower, require more powerful computers, and often require a somewhat tedious project setup for each program you write. These environments have the edge if you write large Java programs consisting of many source files, and they integrate tools such as debuggers and version control systems. We show you how to get started with Eclipse, a freely available development environment that is itself written in Java. Of course, if you prefer a different development environment such as NetBeans or JBuilder that supports the current version of Java, then you can certainly use it.
Because you can compile and execute source code from within the editor, it can become your de facto development environment as you work through this book.
In sum, you have three choices for a Java development environment:
• Use the JDK and your favorite text editor. Compile and launch programs in a shell window.
• Use an integrated development environment such as Eclipse, or one of many other freely or commercially available development environments.
• Use the JDK and a text editor that is integrated with the JDK. Emacs, TextPad, and JEdit are so integrated, as are many others. Compile and launch programs inside the editor.