Eclipse 3.2 is installed on the hedge and bramble machines at Stanford under /usr/local/bin. To use this installation, just type eclipse. (Check out the Java on Unix page to see how to set your path). Note that you have to ssh into a hedge or bramble machine (such as hedge.stanford.edu) in order to use this installation. For those who are used to the Solaris machines (i.e. elaine.stanford.edu), this will NOT work because as of version 3.2, Eclipse is no longer built for Solaris 8/Motif. For those who don't know what an elaine is, feel free to ignore this and go ahead to run Eclipse from hedge.stanford.edu. Look here for a guide on how to establish a remote SSH session with X forwarding.
Mac X11 users: try ssh -Y if ssh -X doesn't work for you.
Report any errors to firstname.lastname@example.org. Remember to describe precisely what happened when you encountered the error. This includes the name of the machine, the command you ran, the error message you got, and if possible the environment variables of your shell (run setenv to get them).
If you prefer to work from your room, you can get Eclipse here. Eclipse is available for Windows, Mac OSX, Linux, and a variety of Unix platforms. You will also need the Java Development Kit (JDK) available here. We'll be using version 1.5 this quarter. Mac OS X machines have Java 1.4 built-in. For Java 1.5, Mac users need to be running Mac OS X 10.4 and then download the latest Java 1.5 from the apple site.
You will want to create a new project for each assignment in CS108. This will let you separate the files for each HW into different folders. Before you start, make sure you're using the Java 1.5 environment. Go to Window->Preferences. On the left pane, click Java->Editor->Installed JREs. Make sure that the 1.5 JRE is added and checked.
Then click Next. Now, give your project a name. Click "Create project from existing source" and add then add the directory in which your project lives. We want to use Java 5 (also known as Java 1.5), so you can either specifically select it, or set 5.0 to as the default. Also, click on "Use project folder as root for sources and class files."
Now, just click Finish and you're done creating the project! If it asks you to switch to the Java Perspective, say yes.
Another thing you want to do is make sure the project is using the correct JRE. Right click on your project in the Package Explorer on the left and click on Properties. Select Java Build Path and Choose the Libraries Tab. If the JRE is 1.5, you're fine.
If this isn't the case, you need to set a
different JRE for the project. Click on "JRE
System Library", and then click Edit. Select
Alternative JRE and select the JRE you want
from the drop down box.
Now if you want to stop debugging at any time, click Run->Terminate. (If you see a blue "all done" in the Console at the bottom, then you have finished running the program, and you won't be able to Terminate.
When you run the debugger, the program will now stop before executing the lines with breakpoints.
In the picture above, I placed a breakpoint on the line that says i++.You can step through your program one instruction at a time. You can choose to step into methods or over them. This can be done from the Run menu, or by using the buttons on the Debug toolbar:
To set a breakpoint that triggers only when certain conditions are true, i.e. a conditional breakpoint, or set them to trigger only after being hit a certain number of times, right-click the blue dot/breakpoint and select Breakpoint Properties....