Eclipse is a commonly-used Integrated Development Environment (IDE) for program development.

Starting Eclipse

On many systems there is an icon for you to double-click to start up Eclipse. If you’re using Linux and without an Eclipse icon, enter this at a command-line prompt (the “ unix-% ” is the operating system prompt, you don’t need to type that, and the " & " tells unix to run the process in the background, letting you continue to use the command prompt):

unix-% eclipse &

Either way, you’ll be prompted to specify a workspace directory; specify yours as /home/yourLoginId/workspace (Choose another, appropriate directory on Windows or Mac.). You’ll have to start Eclipse this way every time you sit down to program. There’s a checkbox you can check so that Eclipse does not continually ask you for your workspace directory; if you didn’t check it this time, you can check it the next time you start Eclipse.

Warning: Eclipse is very particular about its workspaces. Never move or remove projects from a workspace folder unless you use Eclipse itself to do this. Many students try to move a workspace to a new location without Eclipse’s help; really bad things will happen if you do this.

The first time you start the Eclipse Platform it will show you a welcome screen. Go ahead and click the "X" next to the word "Welcome" to go to the default view. You should then see a screen similar to this:

The windows that comprise this view are together known as a "Perspective". The default perspective is one suitable for Java development, but we are interested in doing Python development. To get appropriate windows for our purposes:

  1. Click on the "Window" menu option → Open Perspective → Other...
  2. Choose "PyDev".
  3. Click "OK"

Creating the Project

Eclipse uses projects to keep different software projects separate. For your purposes, think of everything you do for this course as being part of one project.

Creating a project

  1. Right-click in the PyDev Package Explorer Window which should be on the left side of your screen. (Alternative: select File→New→Project...).
  2. Select PyDev Project (maybe PyDev→PyDev Project), and press Next>.
  3. On the screen that appears, do each of the following:
    1. Begin by entering the following values:
      • cs108 for the Project name
      • Python for the project type
      • Grammar Version 3.0
    2. Click on the prompt to configure an interpreter:
      • Choose New...
      • Enter python3.4 as the Interpreter Name
      • Specify the Interpreter Executable - Likely values for different systems are as follows.
        • Linux: /usr/bin/python3.4
        • Windows: In most cases, choosing “Auto-config” will work correctly, just verify that you’re using Python 3 rather than Python 2. The executable path is likely to be C:\python34\python.exe
        • Mac: The auto-config will probably not work. Instead, you will need to manually configure the interpreter; the executable path might look something like this: /Library/Frameworks/Python.framework/Versions/3.4/bin/python3
      • Click "OK"
      • Click "OK" again
    3. Choose python3.4 as the Interpreter.
    4. Click the radio button to "Create 'src' folder and add it to the PYTHONPATH"
    5. Click Finish.
  4. You may be asked by Eclipse if it can rearrange your windows for the "PyDev Perspective". You want this, so say Yes.
Do this...

Follow these directions to create your cs108 project. You will add all your class materials to this project.

You should now see “cs108” in the Package Explorer on the left side of the Eclipse. Expand the project by clicking on the triangle to the left of its folder icon. You’ll see an indication that this is a python3.4 project and a src folder.

Adding Other Materials to a Project

You can create additional packages, directories and files in your project for various purposes. For example, each new lab and homework assignment asks you to create a new folder to store its files. You can do this as follows:

Creating a folder in a project

  1. Select the PyDev Package Explorer window.
  2. Expand the cs108 folder (if it is not already expanded) by clicking on the arrow next to it.
  3. Right-click on the src folder.
  4. Select the New→Folder menu item to open the New Folder dialog.
  5. Enter the folder name. Each lab and homework will specify the name of folder you should create. For now, create a folder called "lab01". BE PRECISE! No spaces, no capital letters, only two numbers, etc.
  6. Press the Finish button.

Text files can be created in a similar manner (e.g. right-click on the lab01 folder, select New→File).Text files should have a .txt extension and Python files should have a .py extension.

Finding Your Project Files

If you want to use your standard operating system to find the raw files that Eclipse creates and maintains, you can find them under the directory path: eclipseWorkspacePath/cs108/src/. Knowing this path is useful when you need to submit your work.

Back to the top of this page

If you are in the midst of lab01, you should now return to those instructions.