Eclipse Banner Eclipse IDE Tutorial

IBM's Eclipse is a program that is used to write applications (other programs) in a variety of programming languages. It allows you to complete many distinct program development steps in one place (program window). A program which allows you to do this is known as an integrated development environment, or IDE.

In this course, Eclipse is used for writing programs in Java. There are several steps that must be completed to set up Eclipse and further steps to start up a new Java project (set of Java components which work together to make up an application). This tutorial explains each step with words and graphics from the Eclipse IDE.

This tutorial will help you to become familiar with the Eclipse IDE. You can navigate through the tutorial step-by-step by clicking on the previous step and next
step links at the top and bottom of each page. You may also use the index to jump directly to the specific step that you wish to review.

Index

Here is a brief description of each step in this tutorial. The underlined word in bold is used as the link label throughout the tutorial. Though most of the images are taken from a different version of windows (not XP), they are very similar to what you'll see.
Start The start of the tutorial (top of this page).
AT HOME WINDOWS 7 USERS Step 0: WIN 7: How to create a shortcut to Eclipse.
Launch Step 1: How to launch the Eclipse IDE.
Config Step 1b: Set Suggested Editor Preferences
Create Step 2: How to create a new programming project.
Edit Step 3: How to edit an existing project.
Run Step 4: How to run your program. This also includes building or compiling your project.

Change folder options to display file extensions

You only need to do this once in the course, but both partners should do it. Files in windows include extensions to let the computer know what sort of file it is. For example, a file could be an image, a java program, a website, or a text document. Windows assume the average user does not need to see the extension, but as computer scientists, we want more control over our computers and the files saved on them.
  1. Click on the button on your desktop.
  2. Select Computer from the menu.
  3. Click the "Organize" menu and choose "Folder and search options..."
  4. A new window titled Folder Options will appear, click on the View tab.
  5. Check the box next to "Display the full path in the title bar (Classic theme only)".
  6. Uncheck the box next to "Hide file extensions for known file types".
  7. Click OK to exit and save the change.
  8. Click the close window button in the upper right hand corner of the Control Panel to close the window.

Window buttons

We're almost ready to start Eclipse!

Step 0: AT HOME USERS

After you downloaded the Eclipse package from Eclipse.org, be sure to uncompress the contents of the file. Note that at the time of this writing (Fall 2014) the latest version is 4.4 codenamed Luna. (As of 9/29/14, 4.4 was not yet available for Mac user). The 4.2.2 codenamed Juno (or 4.3 Kepler) will also be fine in case you have already downloaded the previous version of the software. Uncompressing is also known as (unzip untar unpack) and you can usually do this by right-clicking the file name and selecting unzip.

Remember where you uncompressed the files to, and find the file named eclipse.exe (WIN 7).

In Windows 7:

The Eclipse application was not automatically added to your Start menu, the next few steps will show you how to Pin (WIN 7) Eclipse to your taskbar (or you can choose to pin to the Start menu). There are similar ways to create shortcuts in MAC/Linux installations.

  1. Right-Click on the Start button in the lower left corner of your desktop.
  2. Select the Open Windows Explorer option.
  3. If you look enough, you should be able to find the Eclipse.exe file in the Eclipse folder that was created when you extracted the Eclipse files from your download.
    Windows Explorer window with <tt>Eclipse.exe</tt> highlighted
  4. Right-click the Eclipse.exe file and drag (without releasing) to the Start menu or task bar. Release when you have pinned this program shortcut where you like. This will create a shortcut for launching Eclipse.
    Pin Eclipse.exe to the taskbar
Now, we're ready to start (launch) the Eclipse application!

Step 1: How to launch and configure the Eclipse IDE

Launch Config Create Edit Run previous step next step

This step will show you how to start the Eclipse program on the Windows 7 operating system.

LAB USERS: You can find a link to the Eclipse program in the start menu. Click this link to launch Eclipse and then follow instructions for setting the Workspace location. Note that there may be more than one versions of eclipse installed. This tutorial has screen shots of the Luna version (4.4)

AT HOME OR LAB USERS:

  1. Click your newly created shortcut to launch Eclipse. When you launch Eclipse, you will be shown the following splash screen while it loads, which can take a few minutes:
    Splash screen

  2. After launching Eclipse for the first time, it will first ask you for a workspace location with an image like the following: Workspace launcher

    A workspace is a folder on your local drive (home users) or the network (lab users) where the files created by Eclipse will be stored. When you create a new programming project, several files are created and Eclipse will organize them within a new folder that is within the workspace folder you select.

    Enter the location (on your home computer or on the network) where you wish to store all files created by Eclipse projects.

    CS WINDOWS LAB USERS: Enter in the following location L:\private\cs302\programs and make it so that this is the default choice, as in the following image:

    CS LINUX LAB USERS: Use the following location /u/c/s/cslogin/private/cs302/programs.
    NOTE: /u/c/s/cslogin is different for each user. If your login name is badger, your user folder is found at /u/b/a/badger.


    Workspace
launcher

  3. You will then be presented with a welcome workspace like the following (version 4.4):
    Welcome Workspace
    You can optionally explore the various icons as you wish. The next time you run Eclipse, you will not be shown this welcome screen, but all of the information it contains can be found elsewhere. Or, you can open it again via Help → Welcome.

    When you are done, close the Welcome pane by clicking the X on the tab labeled Welcome(towards the top left of the Eclipse window), then continue to the next step of the tutorial and use the Eclipse IDE to develop your Java programming project.

    An empty Eclipse workspace looks like this.
    Empty Workspace with panels for Package Explorer, editor pane, Problems, Outline, and navigation menus at top

Configure: Set Suggested Eclipse Window Preferences

1. Open the preferences dialog window

  1. Click Window in the Eclipse menu bar
  2. Click Preferences

2. In the preferences dialog, set these preferences

  1. Expand (click) General
  2. Expand (click) Editors
  3. Click Text Editors

3. In the Text Editors option panel

  1. Check the box to select [turn on] each of these options:
    • Insert spaces for tabs
    • Show print margins
    • Show line numbers
  2. Set Print Margin column to 80.
  3. See Colors and Fonts if you wish to change the display of your editor window.
  4. Click [Ok] to save your selections.

Once set, your Text Editors preferences window should look like this:

preferences window with spaces for tabes, print margins, line numbers, and 80 character column guide set

 


Launch Config Create Edit Run previous step next step


Original version created by Deb Deppeler and Sue Hazlett
Updated for Eclipse by Martin Hock
Updated for lab section use by Beck Hasti
2008-2012 Updated by Jim Skrentny
2012 Updated for v4.2 by Deb Deppeler
2013 Updated by Nick Pappas
2014 Updated for v4.4 and added Editor Preferences by Deb Deppeler