Previous Section  < Day Day Up >  Next Section

Choosing a Java Development Tool

If you're using a Microsoft Windows or Apple MacOS system, you probably have a Java interpreter installed that can run Java programs.

To develop Java programs, you need more than an interpreter. You also need a compiler and other tools that are used to create, run, and test programs.

The Java Development Kit includes a compiler, interpreter, debugger, file archiving program, and several other programs.

The kit is simpler than other development tools. It does not offer a graphical user interface, text editor, or other features that many programmers rely on.

To use the kit, you type commands at a text prompt. MS-DOS, Linux, and Unix users will be familiar with this prompt, which is also called a command line.

Here's an example of a command you might type while using the Java Development Kit:


javac RetrieveMail.java


This command tells the javac program—the Java compiler included with the JDK—to read a source code file called RetrieveMail.java and create one or more class files. These files contain compiled bytecode that can be executed by a Java interpreter.

When RetrieveMail.java is compiled, one of the files will be named RetrieveMail.class. If the class file was set up to function as an application, a Java interpreter can run it.

People who are comfortable with command-line environments will be at home using the Java Development Kit. Everyone else must become accustomed to the lack of a graphical point-and-click environment as they develop programs.

If you have another Java development tool and you're certain it is completely compatible with Java 2 Version 5, you don't need to use the Java Development Kit. Many different development tools can be used to create the tutorial programs in this book.

Watch Out!

If you have any doubts regarding compatibility, or this book is your first experience with the Java language, you should probably use JDK 5 or a tool described in Appendix C, "Using the NetBeans Integrated Development Environment."

NetBeans, which can be downloaded from Sun as a bundle with the JDK, offers a graphical user interface that functions on top of the JDK.


Installing the Java Development Kit

You can download the Java Development Kit from Sun's Java website at http://java.sun.com.

The website's Downloads section offers links to several different versions of the Java Development Kit, and it also offers the NetBeans development environment and other products related to the language. The product you should download is called the Java 2 Software Development Kit, Standard Edition, version 5. If you can't find it in the Downloads section of the site, look for an Early Access section that offers beta releases.

JDK 5 is available for the following platforms:

  • Windows 98, Me, NT (with Service Pack 4), 2000, XP Home, XP Professional (with Service Pack 1), and Server 2003

  • Solaris SPARC and Intel

  • Linux

The kit requires a computer with a Pentium processor that is 166 MHz or faster, 32MB of memory, and 150MB of free disk space. Sun recommends at least 48MB of memory if you're going to work with Java 2 applets (which you'll do in Hour 17, "Creating Interactive Web Programs").

Did you Know?

The Macintosh version of the JDK is available directly from Apple. To find out more about Apple's kit and download the tool, visit the website http://developer.apple.com/java/download.


When you're looking for this product, you might find that the Java Development Kit's version number has a third number after 5, such as "JDK 5.1." To fix bugs and address security problems, Sun periodically issues new releases of the kit and numbers them with an extra period and digit after the main version number. Choose the most current version of JDK 5 that's offered, whether it's numbered 5.0, 5.1, 5.2, or higher.

Watch Out!

Take care not to download two similarly named products from Sun by mistake: the Java 2 Runtime Environment, Standard Edition, version 5 or the Java 2 Software Development Kit, Standard Edition, Source Release.


To go directly to the kit's download page, the current address is http://java.sun.com/j2se/1.5.

To set up the kit, you must download and run an installation program (or install it from a CD). On Sun's website, after you choose the version of the kit that's designed for your operating system, you can download it as a single file.

After you have downloaded the file, you'll be ready to set up the development kit.

Windows Installation

Before installing the JDK, make sure that no other Java development tools are installed on your system (assuming, of course, which you don't need any other tool at the moment). Having more than one Java programming tool installed on your computer can often cause configuration problems with the Java Development Kit.

To set up the program on a Windows system, double-click the installation file or click Start, Run from the Windows taskbar to find and run the file.

The InstallShield wizard guides you through the process of installing the software. If you accept Sun's terms and conditions for using the kit, you'll be asked where to install the program, as shown in Figure A.1.

Figure A.1. Choose a destination folder for the JDK.


The wizard suggests a folder where the kit should be installed. In Figure A.1, the wizard is suggesting the folder C:\Program Files\Java\jdk1.5.0. When you install the kit, the suggested name might be different.

To choose a different folder, click the Change button, then either select or create a new folder and click OK. The wizard returns to the Custom Setup options.

Did you Know?

Before continuing, write down the name of the folder you have chosen. You'll need it later to configure the kit and fix any configuration problems that may occur.


You also are asked what parts of the Java Development Kit to install. By default, the wizard will install all components of the JDK:

  • Development Tools— The executable programs needed to create Java software

  • Demos— Java 2 programs you can run and the source code files used to create them, which you can examine to learn about the language

  • Source Code— The source code for the thousands of classes that make up the Java 2 class library

  • Public Java 2 Runtime Environment (JRE)— A Java interpreter you can distribute with the programs you create

If you accept the default installation, you need around 132MB of free hard disk space. You can save space by omitting everything but the program files. However, the demo programs and Java 2 runtime environment are extremely useful, so if you have the room, it's a good idea to install them.

The source files are not needed for any of the material in this book; they are primarily of interest to experienced Java programmers.

To prevent a component from being installed, click the hard drive icon next to its name and then choose the Don't Install This Feature Now option.

After you choose the components to install, click the Next button to continue. You may be asked whether to set up the Java Plug-in to work with the web browsers on your system.

The Java Plug-in is an interpreter that runs Java programs incorporated into web pages. These programs, which are called applets, can work with different interpreters, but most browsers do not include an interpreter that supports the current version of the Java language. Sun offers the plug-in to provide full language support to Microsoft Internet Explorer, Mozilla, Opera, and other browsers.

After you complete configuration, the InstallShield wizard installs the JDK on your system.

    Previous Section  < Day Day Up >  Next Section