Computing Concepts with Java 2 Essentials

{short description of image}

Help with Popular Compilers


You can obtain the JDK for Solaris and Windows at the products web site.

Install the JDK for your platform. On Windows, this simply means running the install file. When installing, pay careful attention where the Java files are installed. The default is c:\jdkx.y.z, where x.y.z is the version number. For example, c:\jdk1.2.1 . The default is fine, or you can install it at another directory--many people prefer just c:\jdk. However, remember which directory you chose.

After installing the JDK, you need to set your PATH so that you can compile and run programs. Specifically, you need to add the directory of the Java compiler and interpreter to the PATH. That directory is the bin subdirectory of the Java installation directory, such as c:\jdk1.2.1\bin.

Under Windows 9x, locate the file AUTOEXEC.BAT in the root directory of the boot drive (usually c:\). Open the file with a text editor such as Notepad. At the end of that file, place the line

set PATH=c:\jdk1.2.1\bin;%PATH%

However, change c:\jdk1.2.1 to your Java installation directory. Make sure that you type the line exactly as is, with spaces, capitalization, special symbols, etc. completely intact. You may want to copy and paste the line, and then modify the name of the Java installation directory.

Save the file and then reboot your machine.

Note: With Java 2, you no longer need to set the CLASSPATH environment variable.

To compile a file, open a DOS shell and type javac followed by the file name. For example,


To run the file, type

java Homework1

Tip: Run a text editor (such as edit) in a separate window, and keep that window open while you compile and run your program in the DOS shell.

This setup, while primitive, is certainly workable for simple programs.

Problems? If you use Windows, check out the excellent tutorial from Sun Microsystems.

Microsoft Visual J++

Microsoft J++ is not compatible with Java 2. No version of Microsoft J++ is usable with the book. Microsoft has announced that it will no longer support Java in future versions of Visual Studio, so this situation isn't likely to change.

Further Information