COMP 110-001 - Introduction to Programming (Spring 2009)
Lab 0: Getting Started with jGRASP
10 points
Assigned: January 16th
Due: January 22nd by midnight
Part 1: Installing the JDK and jGRASP
To properly install jGRASP, you'll need to download and install both the Java Development Kit (JDK)
and jGRASP.
If you are using Mac OS X, the Java Development Kit (JDK) should already be installed, so you can move on to
Installing jGRASP. If you are using Windows, read on.
Uninstalling the old version of the JDK
If you previously installed an older version of the JDK, you will need to uninstall this
software. Go to Start -> Control Panel -> Add or Remove Programs and click
on the version of the JDK you want to uninstall. Click remove. A box will appear,
click Yes to continue uninstalling the software. You may then be asked to
reboot your computer. Once you have successfully uninstalled the older version of
the JDK, proceed with the rest of the instructions.
Installing the JDK
If you have not already downloaded the Java SDK installer, download jdk-6u7-windows-i586-p.exe
to your Desktop (it's a large file, 77MB). Double-click on the file once it's on your Desktop, and the script will
take you through the steps for installing the Java SDK.
Steps
- In the License Agreement dialog box, click the Accept button.
- In the Custom Setup dialog box, you don't need to make any changes, so just click Next.
- The JDK installation will begin, and you should see a progress bar. The installation may take a few minutes.
- After the JDK finishes installing, the installer will try to install the Java Runtime Environment (JRE). You will see another Custom Setup dialog box,
and again, you don't need to make any changes, so just click Next.
- The JRE installation will run much like the JDK installation did.
- When the installation is done, you should see a dialog box that says "Java(TM) SE Development Kit 6 Update 7 Successfully Installed". Click
Finish.
- You may be asked to restart your computer.
Installing jGRASP
If you have not already downloaded the jGRASP installer, download jgrasp186_09.exe
(Windows only) or jgrasp186_09.pkg.tar.gz.
Then follow the installation instructions for either Windows or Mac OS X given
in jGRASP Tutorial chapter 1,
paying attention to the following notes:
- Ignore the first part of the chapter where it tells you which file to download (you have already downloaded the appropriate file).
- Use all the default installer settings EXCEPT when you are presented with a dialog box asking
you to choose file associations, such as the one shown below. Deselect all file extensions except for .java and .jav.
- After clicking the Install button, jGRASP will install and you should see a dialog box that says
"Completing the jGRASP Setup Wizard". Click Finish.
When you have completed the installation, you should find the jGRASP icon on your Desktop. In Windows, jGRASP should also be listed in the
Start Menu.
Once you have successfully installed the JDK and jGRASP, you
can delete jgrasp186_09.exe (or jgrasp186_09.pkg.tar.gz) and jdk-6u7-windows-i586-p.exe from
your computer.
Part 2: Starting jGRASP the First Time
Double-click on the jGRASP icon on your Desktop to start jGRASP. You may get a message saying that there is a newer version of
jGRASP available online. It's ok, just ignore that message.
There are a couple of settings that you need to change the first time
you run jGRASP. You only need to follow these steps once.
- Go to the Settings menu and highlight Compiler Settings. A sub-menu will pop up.
Select Workspace. A dialog box will open.
- Choose the Compiler tab at the top of the dialog box.
- In the drop-down box next to "Language:", choose Java.
- Choose the Environment tab under the "Language:" drop-down box.
- Click on "jdk (integrated debugger, HotSpot VM, prefer JDK compiler) - generic" so that it is highlighted.
- Click the Use button to the right of the list.
- Click OK.
It would be a good idea for you to read the Getting Started chapter of the jGRASP
documentation through 2.4.
Part 3: Your First Java Program
You will now compile and run your first Java program.
- Create a directory called "COMP110" somewhere on your machine if you have not done so already. For example "C:\COMP110"
- Download (Right-click and Save Target As..) FirstProgram.java to the "COMP110"
directory on your machine.
- Open "FirstProgram.java" within jGRASP by using the File -> Open menu to select ""FirstProgram.java""
in your "COMP110" directory.
- Insert your name into the assignment header in "FirstProgram.java"
- Compile "FirstProgram.java" by clicking the Green Plus icon in the menu at the top.
- Run "FirstProgram.java" and experiment a bit by clicking the Red Running Man icon in the menu
at the top.
Part 4: Submission
After you have compiled "FirstProgram.java" in Part 3, a file called "FirstProgram.class"
will have been created by jGRASP in your "COMP110" directory.
Submit "FirstProgram.java" and "FirstProgram.class" via the
UNC Blackboard System before the deadline.
Grading
- [3] Files submitted correctly
- [3] Assignment header edited correctly
- [4] Class file runs and executes correctly