In CS 106A, we'll be using Stanford's customized version of Eclipse to build our programs. Eclipse is an enormously popular industrial strength Java environment with many features. Fortunately, Eclipse is also open source -- anyone is free to change Eclipse to work the way they want. We have taken advantage of that freedom to install special Stanford features into Eclipse, tailoring it specifically for CS 106A. This document gives instructions on how to get started using Stanford Eclipse. Please pay close attention to these instructions and do not skip steps!
If you run into any trouble installing Eclipse, please feel free to stop by office hours or the LaIR, or ask after lecture.
Our version of Eclipse will only work on macOS 10.6 (2009) or higher. If you don't have a supported version of the operating system, you'll need to either upgrade or do your class work on a cluster machine. You can check your version of macOS using these instructions.
(Note that these screenshots are for Windows, even though they were taken on a Mac) Our version of Eclipse will only work on Windows 7 (2009) or higher. If you don't have a supported version of the operating system, you'll need to either upgrade or do your class work on a cluster machine. You can check your version of Windows using these instructions.
Now that you have set up Eclipse, it's time to work on a project! For each CS 106A assignment, we will provide a skeletal framework called a starter project. Using starter projects makes your life much easier by allowing you to ignore the many details involved in creating a project from scratch. Therefore, for each assignment your first task will be to download the starter project from the class website and then import it into your workspace. Once you do that, you can work on your project. These steps also apply to code from lecture, which will also be provided via a project you import.
When you are done with a project and no longer wish to edit or run it, you can close it. Closing the project does not delete the project, but tells Eclipse to no longer display that project's programs in the list of programs you can choose to run. This may be helpful later in the quarter when you have several projects imported. To do this, right-click on the project in the sidebar and select Close Project.
Its folder icon will change to a "closed" folder. If you would like to reopen a project later, simply double-click on its folder in the sidebar again.
You submit all assignments directly through Eclipse. We check whether an assignment is turned in on time from the time we receive your electronic submission, which is timestamped in the submission process. That time is based on the time on the server that receives the assignment, so it pays to submit things with a few minutes to spare, particularly if you discover that your computer's clock is running slow.
To submit a project in Eclipse, follow these steps:
You can submit as many times as you'd like - your section leader will grade your most recent submission.
IMPORTANT: remember to keep a backup copy of your work. Although we work hard to keep track of all assignment submissions, on occasion assignments are not received as expected, and we will ask you to resubmit. You are responsible for keeping a backup copy of your work, in the event that a resubmission is required. We highly recommend saving backup copies as well, using an external hard drive, a thumb drive, online storage services, etc. See here for other recommended ways to back up your data.
When writing programs in Eclipse, you may run your program and have it behave in a way that you did not intend or expect. In cases like this, you need to "debug", or remove unintended behavior, from your program. Luckily, Eclipse comes with a built-in "debugger", or tools that can help you better understand what your code is doing. Here's how to use it.
srcfolder, and go to New -> Class.