In CS106A, 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 CS106A. This
document gives instructions on how to get started using Stanford
Eclipse. Please pay close attention to these instructions and do
not skip steps!
Configuring Eclipse for CS106A
I need help!
Installing Eclipse on a Mac
Stanford Eclipse will only work on Mac OS X version 10.6 or higher. If you don't have that version of the operating system, you'll need to either upgrade or do your class work in a public cluster.
- Download and install the Java SDK installer for Mac
- Download the Mac version of Eclipse
- DDouble-click on the file eclipse-mac.dmg to open the Eclipse disk image(You can delete eclipse-mac.dmg
- Drag the Eclipse app into the Applications folder on your Mac.
- Drag the Eclipse icon from your Applications folder to your Dock to create a shortcut.
- Click on the icon in the dock to open Eclipse. If you see an error that says Eclipse "can't be opened because it is from an unidentified developer," right-click on the Eclipse icon and select "open" instead. You will be able to open Eclipse without right-clicking from now on.
- Skip to the instructions below to configure Eclipse for CS106A.
Installing Eclipse in Windows
Our version of Eclipse will run on Windows 7 (2009) or higher. In the very unlikely event you have an older version of Windows on your computer, you will need to either upgrade or do your class work in one of the public computer clusters. You can check your version of Windows using these instructions.
- Uninstall previous versions of the
Java Runtime Environment (JRE). Before installing a new version of the JRE, we
recommend that you remove any older copies that may be
installed on your system.
If you have Windows 7 or 8, do the following: Click
on Start, then click on Control
Panel, then select Programs and
If you have Windows 10, do the following: Click
on Start (the Windows icon in the lower
left-hand corner), then click
on Settings (the gear-shaped icon),
then select Apps & Features.
- From the list of programs you see, uninstall
any occurrences of Java/J2SE Runtime Environment, Java
SDK, Java SE Development Kit or Java Update. Note that the
exact program name may
be slightly different or include a version number, but you
generally want to remove anything that includes the text:
Java/J2SE Runtime Environment, Java SDK, Java SE
Development Kit or Java Update. To remove a program, click
on the program name to
highlight it and click the the Uninstall
- Download Eclipse.
Save the downloaded file to somewhere on your hard drive. This may
take a little while as the file is rather large.
- Unzip/extract the contents of the file by right-clicking
on the folder you just downloaded, selecting
the Extract All... option and
typing C:\Program Files as the location to
extract the files to.
Then continue following the steps in the extraction process.
- Create a shortcut to Eclipse on your Desktop for easy
access — Open the C:\Program
Files\eclipse directory, and right-click and
drag the eclipse.exe file (the Eclipse application) to your
desktop and then select the option Create shortcut here.
Note: If you installed the 64 bit versions of the software, and
find that you have issues running Eclipse, we recommend that you uninstall
Eclipse by deleting the C:\Program Files\eclipse directory and install the 32 bit versions of both:
the JRE 32 bit
version for Windows and Eclipse 32 bit version for Windows, in that order.
- Continue to the instructions below to configure Eclipse for CS106A.
Configuring Eclipse for CS106A (both Mac and Windows)
Once you have Eclipse installed on your computer, there are a few CS106A-specific changes you need to make so that you can access some special Stanford features, like submitting assignments. The following instructions apply to all operating systems, although the screenshots are from a Mac.
- Open Eclipse if you haven't already. When you run Eclipse for the first time, you may get a screen that looks like this:
A workspace is just a directory that Eclipse will use to place new projects in. In 106A you won't have to make any new projects from scratch. We will always give you skeleton projects for your assignments, so you don't need to worry about where the workspace is. The suggested location is fine. Click the Use this as the default and do not ask again checkbox, and then click OK.
- Once Eclipse has started, you can close the "Welcome" tab using the "X" in the top left.
- Click Help -> Install New Software.
- In the "Work with" text box, type https://web.stanford.edu/dept/cs_edu/eclipse/plugin and press Enter.
- Click "Select All," then click Next.
- Click Next again.
- Click "I accept the terms of the license agreement," then click Finish.
- Click OK when you see the warning about installing unsigned content.
- Click Yes when asked to restart Eclipse.
- After restarting, you should see a "Stanford Menu" in the top bar, as well as several new icons in your top toolbar area.
- Go to Eclipse -> Preferences to open the Preferences window. In the dropdowns on the left, expand Run/Debug, and click Perspectives. Set "Open the associated perspective when an application suspends" to Never, as shown below, and click Apply and Close.
We now need to change an Eclipse setting. By default, Eclipse hides (or "folds") the program comment at the top of each code file; we want to have those always be visible. To change this, first open Eclipse preferences (Eclipse -> Preferences on Mac or Windows -> Preferences on Windows). In the filter text box, type folding.
In the results on the left, underneath "Java>Editor", click Folding. In the view that appears, make sure to uncheck Header Comments. Then click Apply and OK.
Finally, we need to disable news feed polling. To do so, go again open Eclipse preferences (Eclipse -> Preferences on Mac or Windows -> Preferences on Windows). In the filter text box, type News. Click on News, then untick the "Enable automatic news polling option". This prevents you from getting the pop-up: "an internal error occurred during: "Polling News Feed"".
Now that you have Eclipse loaded and configured, your next step is to add a project to your workspace by importing a skeletal framework that we provide with each assignment 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. Every assignment will include a starter project for each problem, and your first task for each assignment will be to download the starter project from the class website and then import it into your workspace. The details for doing so are described in the handout "Programming with Karel".
Having trouble with your installation?
Check out this doc for
, stop by the instructors' Office Hours or the LaIR, email the instructors, or post on Piazza.
Q: Eclipse is showing an error in the Console "Could not save C++ lib configuration file". Do I need to worry about this?
A: No. This error should not affect the running of your programs, and you can ignore it.
Q: I want to create another file/program within this project. How do I do this?
- Right-click on "default package" within the
src folder, and go to New -> Class.
In the "Name" field, enter the name for your new class (do not include ".java"). Click "Finish".
- This will create a new file in your project. Replace the code in that file with the code you would like to include.
Q: Help! I don't see the "running person", submit, import, etc. icons or the "Stanford Menu" in my Eclipse.
A: This means the Stanford Plugin is not installed; please repeat steps 8 onwards in either the Mac or Windows installation instructions above.
Q: My Eclipse window doesn't look like the ones in the screenshots or in lecture. I'm missing some of the panels (e.g. the sidebar showing all my projects). Help!
A: Click the "Reset" button in the Stanford Menu to reset to the default view.
You may also be in Debugger mode instead of Editor mode; use the Stanford Menu to go back to Editor mode.
Q: Help! Eclipse is not letting me import a project. It gives me a warning at the top that "Some projects cannot be imported".
A: This is because a project with that name is already imported into Eclipse. If you would like to import this project, you must first delete the existing project by right-clicking the project in the sidebar and selecting "Delete". You can then choose whether to delete the project from your computer as well, or just delete the project from Eclipse.