Configuring Java to work at home

There are three things you will need in order to write Java programs for this course:

The Java 2 SDK

The Java 2 SDK is available, for free public download, from Sun Microsystems. Go to their Java web site, and select Java 2 Standard Edition, a.k.a. J2SE. Download the full SDK, including the Java Runtime Environment, and install it on your computer in a directory of your choice. Note that after the installation, the source Java files for the entire language are contained in a compressed file in the Java directory. If you would like to download the API specification for the language -- the HTML information about all of the language features -- you will have to download it separately.

Development environments

There are many Integrated Development Environments, or IDEs, available for use with the Java language. Some are free, others are cheap, and some are very expensive. Choose one that suits your tastes and your wallet. We use Metrowerks CodeWarrior, but it might not suit you. The best free option is probably Sun ONE Studio, formerly known as Forté. (Only the community edition is free.) If you prefer a command-line, makefile environment, the Java SDK includes all of the programs necessary to work in this style. Use a simple text editor to write your code, then use the command-line tools to compile, document, and run your programs.

The Java Power Tools

The Java Power Tools are bundled in a single file named jpt.jar, which can be downloaded here. This Java ARchive -- hence .jar -- is a collection of compiled Java code containing tools for use when writing Java programs. The programming exercises you are to perform in this course require that this file is accessible to your Java environment, which is made up of both the Java SDK and your development environment. In order to make the JPT accessible to your system, you must configure either Java, your IDE, or both.

If you do not want to use the command-line tools provided in the Java SDK, skip the next paragraph. If you are going to use an IDE other than Metrowerks CodeWarrior, you may have to come back to the next paragraph later.

To configure the Java SDK to have access to the JPT, you must modify an environment variable known as the CLASSPATH. On older Windows/PC computers, the environment variables are set in a file named autoexec.bat, usually located at the root of your boot disk. (For example, in c:\ for a hard drive, or a:\ for a floppy.) Open up this file, and ensure that the CLASSPATH contains the lib directory of your Java install path. Put the jpt.jar file in that directory, and add its full exact path to the CLASSPATH, just to make sure it can be found. Specifically, add ";%JAVA%\lib\jpt.jar" to the end of the CLASSPATH, replacing %JAVA% with your Java install directory. On newer Windows/PC computers, the environment variables are usually set through the System panel among the Control Panels.

To configure your IDE to have access to the JPT, it depends on the product. In Metrowerks CodeWarrior, you should add the jpt.jar file to the directory %CW%\Java_Support\Libraries\, replacing %CW% with your CodeWarrior install directory. You should put it there in addition to the directory specified above for the Java SDK. Once the file is there, you should add the jpt.jar file, from the CodeWarrior directory, to any projects you create. Projects downloaded for this course will already contain jpt.jar, and expect it to be in the Java_Support\Libraries directory.

If you use a different IDE, the rules are different. Just making the Java SDK CLASSPATH reference jpt.jar might be enough. You may need to put the file in a specific directory, as with CodeWarrior. You may need to add the file to a list of libraries for use with the IDE, or to a list for each specific project. Check all of the documentation you can find for your IDE, including FAQs about the product, and if you still can't figure it out, I might be able to help.