CS106A Eclipse Instructions
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!
NOTE: if you run into any issues while installing or using Eclipse, please see the bottom of this page for troubleshooting steps.
Installing Eclipse on a Mac
Stanford 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 by clicking the "Apple" menu in the upper left-hand corner of the screen and selecting About This Mac.
- Download and install the Java SDK for Mac
- Download and install Eclipse for Mac. Drag the Eclipse app into the Applications folder on your Mac when a window appears with Eclipse and your Applications folder.
- 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.
- Now you'll need to install the 106A-specific customizations. Skip to the section "Installing the CS106A Plugin" further down the page for more information.
Installing Eclipse in Windows
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 you'll need to install the 106A-specific customizations. Skip to the section "Installing the CS106A Plugin" further down the page for more information.
- Remove any older copies of the Java Runtime Environment that may be installed on your system.
If you have Windows 10: Click on Start (the Windows icon in the lower left-hand corner), then click on Settings (the gear-shaped icon), then select System, then Apps & Features.
If you have Windows 7 or 8: Click on Start, then click on Control Panel, then select Programs and 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 button.
- Download and install the Java SDK for Windows
- Download and install Eclipse for Windows
- Extract the contents of the file by right-clicking on it, 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 the 64 bit versions of both the JDK and Eclipse and install the 32 bit versions of both:
(Both Mac and Windows) Installing the CS106A Plugin
Once you have installed Eclipse, you will need to follow these instructions to add the customizations we have made for CS106A. The instructions are the same for Mac and Windows, even though the screenshots are taken from a Mac.
- 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.
- When starting Eclipse for the first time, you may be greeted with a Welcome pane. Click the checkbox in the bottom right to disable this, and click the "X" at the top of the welcome tab to close it.
- 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.
(Note that the "Work with" URL in the image may be different than the one you should enter.)
- Click Next again.
- Click "I accept the terms of the license agreement," then click Finish.
- If presented with a prompt confirming you want to install, confirm the installation
- 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.
- Now that you have Eclipse set up, your next step is to create a new project in your workspace by importing a skeletal framework that we provide 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 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 "Using Karel with Eclipse".
- 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: 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 the steps under "Installing the CS106A plugin" 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: Eclipse is not letting me import a project. It gives me a warning at the top of the import window 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.
- Q: When I run a Karel program, it immediately crashes with an "Unsupported Version Error".
A: This means Eclipse is using Java 9, which is not compatible with running your programs. See the solution to the following question about being unable to run programs.
- Q: When I click the running person icon to run programs, Eclipse gives me an error that it "could not find any programs to run", even though I have a project imported with programs.
A: This means Eclipse is using Java 9, which is not compatible with running your programs. To change Eclipse to use Java 8 instead, follow these steps:
- Open Eclipse Preferences: On Mac: in the top toolbar, go to Eclipse -> Preferences. On Windows: in the top toolbar, go to Window -> Preferences.
- Change JRE version to 8: In the sidebar of the preferences window, expand the "Java" section. Click on "Installed JREs". If the checked option is a version of Java SE 9, instead check the box next to Java SE 8 [1.8.0_152]. Click "Apply" in the bottom right.
- Change Compiler version to 1.8: In the sidebar of the preferences window, click on "Compiler". If the "Compiler compliance level" is 9, change it to 1.8. Click "Apply" in the bottom right.
- Close the preferences window. You should be good to go!