CS110 Exercise 2  (5 points)

Goal for today:  Download book examples, and download DrJava to your laptop and get it to run.
Fill in check marks in short ___'s or requested information in longer ones.Turn in one copy and retain another for your own use.

1. Browse to our class web page at www.cs.umb.edu/~eoneil/CS110 ___

2. Download the Chapter 2 book examples linked to the class web page under "Textbook" if you haven't already. Use Windows Explorer or Finder to drag and drop the Chap02 directory to be under your cs110 directory. ___

3. Check that you can find the Chap02 directory using Command Prompt or Terminal.
PC: cd c:\cs110    to get to your cs110 directory from anywhere
       dir              to see things there
       cd Chap02  change to the Chap02 directory
       dir               should see Echo.java, etc  
       type Echo.java     to display it ___
Mac: cd ~/cs110   to get to your cs110 directory from anywhere
       ls                 to see things there
      cd Chap02   change to the Chap02 directory
       ls                should see Echo.java, etc  
       more Echo.java      to display it.___

4. Compile and run the book examples Echo.java and GasMileage.java.  Commands: "javac Echo.java" then "java Echo", etc.
Show what happened for Echo: what you typed, what the computer typed, line by line:

_____________________________

_____________________________

_____________________________

_____________________________

5. Find the link on the class web page for the DrJava download under Lab Supplies and Development Tools  SourceForge Dr Java Download Page. Click on "Download Windows App" or "Download Mac OS X App" as appropriate. ___

6. Because we downloaded a recent Java distribution and made it show up on the system (in the search path), DrJava should run without any configuration.
PC: Find the executable in your Downloads directory using Windows Explorer and drag its fancy-J icon to your Desktop.  You can change the name on the icon if you want.  If you use Chrome, you can right-click the icon at the bottom of the window used for the download and select "Show in Folder". That will bring up Windows Explorer on the Downloads directory. ___
Mac: If you use Safari, the download ends up with a little box in the upper right-hand corner of the browser window. Double click this to see the download, and double-click the drjava....tar file that shows there.  Move the resulting fancy-J icon to the desktop.  If it fails to run with the error "DrJava is corrupted and should be moved to trash", it can be run by right-clicking it and using Open. This error can be prevented by using the System Preferences>Security & Privacy panel to allow all downloaded apps to run, at least temporarily. ___

7. Run DrJava and use the Open Folder command. Navigate to the directory Chap02 that contains the book examples for Chap. 2 and click Select. You should see Addition.java, ..., TempConverter.java listed on the left hand side. 
a. Select Echo.java and see it displayed in the editor window.
b. Click Compile
c. Click Run (on the far right of the top menu bar). If Run is cut off because of a small screen, you can run use Tools>Run Document
d. Break the program by typing something into it like "xxxx".  Try to compile it and see how it reports the problem.

Your changed line in Echo.c: _________________________________

The error message: __________________________________________-
e. Where can you type xxxx and still compile the program?

Answer:_________________________________________________________________

8. Copy and paste Hello.java from the class web page into a New DrJava editor buffer, that is, first click New in DrJava, then do the paste into the blank editor window. ___

9. Save the result, compile and run it.___

Now you should be ready to compose your own programs in DrJava!