CS 40 Spring 2012 Java Setup Instructions :

Setup JAVA Compiler on your computer:

1. For Windows, goto cle.com/technetwork/java/javase/downloads/jdk-7u3-download-1501626.html ; goto the middle of the page, and choose either Windows x86 (32-bit) or Windows x64 (64-bit). If you don’t know which one to choose, you need to open the Control Panel, find the “System” icon and click on it. It should display your computer system information. In the System Type field, it should have either 32-bit or 64-bit Operating System. Pick the one that matches.

2. If you install the download package, you should change the installation directory to c:\Java173. If not, it will install in directory C:\Program Files\Java\jdk1.7.0_3

3. For Mac OS X, you should have Java Compiler already. For previous versions of Mac OS, you can download the JAVA SDK from the Apple download site.

4. Verify your installation on Mac. Open a program name “Terminal”, this will open a command prompt. Type in “javac” on the command prompt and it should display a page of options on the screen.

5. For Windows, open the command prompt by opening Start->All Programs->Accessories->Command Prompt. Type in the following command

“set PATH=%PATH%;%ProgramFiles%\Java\jdk1.7.0_3\bin” if you didn’t rename the install directory

OR “set PATH=%PATH%;C:\Java173\bin” if you rename the install directory to c:\Java173

6. Type in javac on the command line and it should display a page of options on the screen.

Testing the CS40 sample program:

1. Download p1.java & consoleReader.java from the class webpage. Save both of these 2 files into a directory in your computer. For Windows, I recommend you to create a directory by this command “md c:\cs40”, then save those 2 files to the newly create directory.

2. For Windows, if you save your files in “My Documents”, you would need to change the directory by enter the following in command prompt -> “cd %HOMEPATH%\My Documents”.

3. Once you are in the directory of your files p1.java and consoleReader.java. Type “javac p1.java”. If successful, no message will be displayed.

4. Now you are ready to run the program by entering “java p1” into the command prompt.

5. You can experiment with adding some code in option #3. Once you add or modify code in p1.java. Just repeat step 3 and 4 above.

Bring your laptop to class for the next few weeks, we examined the content of p1.java on Tuesday (4/24). You can find the Java language documentation from here -> cle.com/javase/7/docs/api/index.html