Creating Java Programs at Home

Java Development Kit (JDK) — the compiler

First, you need the Java Development Kit (JDK) from Sun. This is the actual compiler that JCreator uses behind the scenes. Even if you already have Java installed, you probably still need this. (Most people only have the Java Runtime Environment (JRE) installed, which allows you to run existing Java programs but not compile new ones.)

Windows

Direct your web browser to http://www.oracle.com/technetwork/java/javase/downloads/

Click the "Download JDK" button next to JDK 6 Update 27, or any newer version if desired. You probably want the "Windows x86" version, which should be around 77 MB. Save this file in a location you can remember. Once downloaded, run the executable. Follow the prompts to install the JDK. You'll need administrator access.

Next, you'll need to set an environment variable so that the command prompt can find the java compiler. You can find instructions for editing the PATH here.

Once you've added Java's bin folder to the PATH environment variable, you can try the Compiler Check assignment to make sure you've done it right.

Mac OS X

Good news! The JDK is usually installed by default on Macs, so just open up "Terminal" and try the Compiler Check assignment to make sure.

Linux

On Debian-based distros (such as Ubuntu), you should be able to open up a terminal and install the JDK like so:

login@localhost:~$ sudo apt-get install sun-java6-jdk

Then, just try the Compiler Check assignment to make sure everything worked.

JCreator — the integrated development environment (IDE)

Although you can create Java programs in any text editor and compile/run them from the command-line, most students are more comfortable with an Integrated Development Environment that handles these things for them. The one we use in class is JCreator LE, and it's free for personal use. (JCreator Pro is not free, but it doesn't have any features that we need anyway.)

Direct your web browser to http://jcreator.org/download.htm

Click the download button next to JCreator LE v5.00. Note: that's JCreator LE, not JCreator Pro. Run the executable to install and just follow the prompts.

If you installed the JDK first and installed it in the default location, then JCreator will find the JDK for you. Otherwise, at some point during the installation process you'll need to tell it the location of the JDK's bin folder on your system.

GridWorld

Download the GridWorld code from the College Board here:

http://apcentral.collegeboard.com/apc/public/repository/GridWorldCode.zip

If you'd like to easily use GridWorld from JCreator, you should extract the file gridworld.jar from the ZIP file and copy it somewhere you'll remember, like perhaps the folder lib inside the JDK's folder.

You don't need any of the other files from the ZIP file in order to use GridWorld in JCreator.

Then, in JCreator, navigate to Configure | Options... | JDK Profiles. Highlight the existing profile (probably JDK version 1.6.0_21) and then click the Edit button. Then, choose Add | Archive. Browse to the location where you saved gridworld.jar, select it and click Open.

Hopefully, everything works! Good luck.

updated 2011-08-31