Preparing to Use Java with JGrasp on Your Computer

CS 1050 – Mr. Kramer

The steps below will help you prepare your computer for compiling and running Java programs. The steps will enable you to:

1. Download and install the latest version of Java

2. Prepare JGrasp, the Integrated Development Environment (IDE) for using Java

3. Compile and run a test program to ensure the environment is set up correctly

Here are the details.

1. Download and install the latest version of Java

1a Visit the home page: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Instead of typing the link in, you can access it directly from http://www.jGrasp.org and select the “Download” link in the menu at the upper left of the screen.

1b Press the download button

1c Read the license agreement and select the “Accept License Agreement” button

1d Select the file on the right corresponding to the appropriate computer environment. The most likely choice will be for Windowsx86. (Windows x64 is for a 64-bit machine.) A download begins and will take a while as it is over 80 MB.

NOTE! The “File Size” and “Download” column names will probably be different, reflecting different versions.

1e You are prompted to [Open] or [Run] the file. Select [Open]. If you are not prompted to [Open], it means the file is automatically being downloaded. You will have to locate the downloaded file and double-click it to start the installation.

1f After clicking [Open], you may be prompted again to click [Run] to start the installation.

1g Accept all default prompts during the installation.

1h At the end of the installation process, you have a choice: [Next Steps] or [Close]. The former opens a window that enables you to download tutorials and additional documentation.

1i. Below the installation selection (shown above) are two optional files you can download for samples of Java.

2. Prepare the Integrated Development Environment (IDE) for using Java

After Part 1 is successfully completed, you can install the JGrasp Integrated Development Environment (IDE) which requires that Java already be installed on your computer.

2a Visit the JGrasp home page, http://www.jGrasp.org (.org, not .com)

2b At the upper left-hand corner of the home page is a menu. Select Download.

2c Note that the next information requested is optional, but completing it helps the JGrasp developers:

2d Complete your email and name information a few lines down. Decide about the “OK to contact me” option:

2e Skip any references to Beta releases and locate buttons for the latest production version. Note that the version number and date (at the upper left of the figure) might be different. Press the appropriate button. Most likely you will use the button for the Windows self-extracting version.

2f You will be asked to [Open] or [Run]. Select [Open] to start the installation.

2g Accept all default prompts during the installation

2h Optionally, download the tutorials (again, the version number and date might be different):

2i Locate the downloaded Zip file and move it to a folder into which you can unzip it.

3. Compile and run a test program to ensure the Java and jGrasp environments are set up correctly

3a Locate the JGrasp icon on your desktop (shown at the left) and double-click it to start JGrasp (it takes a few seconds to load). You may want to pin this icon to the taskbar in Windows.

3b Set the stage to create a new Java program by selecting from the File | New menu:

Note: The first time, “Java” might not show on the pulldown list so you may have to select “Other” and then “Java”

3c From the pulldown menus (below left), select View and check off Line numbers, or press Ctrl-L, or click the Line Number icon (below right). This causes line numbers to be displayed in the program area of the screen.

Line

Number

Icon

3d Type in the following Java program in the program area at the upper right (the large empty box) exactly as written, with upper and lower case as shown. Highlight the large box to select it to start typing. You do not type in the line numbers; they are for reference only. Note that the parentheses-looking characters are the curly braces, {…}, not parentheses, (…)

3e Save the program with File | Save As:

and enter this name for the file name: TestJavaInstallation (it will default to that). Click “Save” to save the file.

3f Compile the program by pressing the green compile button (a green “+” sign) around the center-top of the screen:

3g In the dialog window at the lower right, you will see:

3h Run the program by pressing the Run (it might be labeled Run General) button to the right of the Compile button:

3i In the dialog winder at the lower right, you will see:

3j Congratulations! The Java and JGrasp programs are successfully installed!

3k Exit JGrasp by simply closing the entire window.

Page 3 of 3