Concepts / Installing and Launching Eclipse

Installing and Launching Eclipse

A workspace is the directory where your work is stored, and you can use several workspaces and choose one at startup.

  • Programming

Where Your Work Ends Up

Imagine you have just installed Eclipse and written your first Java program. When you close the program, where does that work go, and how would you find it again next week? Eclipse answers this with a single idea: every piece of work you do in Eclipse is kept inside one place on your computer. Understanding that place, and the way the Eclipse window is arranged around your work, is the foundation for everything you will do in the environment.

This article builds that understanding in three steps. First you will look at the workspace, which is where your work is kept. Then you will look at the window, which is made of sections and views. Finally you will look at perspectives, which group those views for different jobs.

Choosing a Workspace at Startup

A workspace is the directory where your work is stored. Eclipse does not create it silently in the background. The first time you start Eclipse, it asks you to specify a workspace. You can accept the default name that is offered, or you can type a name of your own.

The choice matters because the workspace is the directory where your work is kept. The name you pick therefore tells you where to look later. A name chosen carelessly is a name you may struggle to recognise when you come back to your files.

  1. 1
    Launch Eclipse on your computer.
  2. 2
    Eclipse asks you to specify a workspace.
  3. 3
    Accept the default name offered, or type a name of your own.
  4. 4
    The workspace you chose is the directory where your work will be kept for this session.
  5. 5
    The Eclipse window opens, showing the contents of the workspace you selected.

Several Workspaces, One Installation

A single installation of Eclipse is not limited to one workspace. You can use multiple workspaces and select the one you want at startup. Each workspace is kept separate, so the work in one does not have to mix with the work in another.

Worked example

Keeping coursework apart from a separate project

You are taking a programming course and also building a separate project of your own. You want the two sets of work kept apart while using the same Eclipse installation.

  1. 1
    Create or name a workspace for coursework

    When Eclipse asks for a workspace, you type a name that identifies coursework, so that the directory holding that work is easy to find.

  2. 2
    Use a second workspace for the separate project

    On a later launch, you choose the other workspace instead. Its contents, not the coursework contents, appear in the environment for that session.

  3. 3
    Select between them at each launch

    Because the workspace is selected at startup, you switch context simply by choosing a different workspace the next time you start Eclipse.

Result

One Eclipse installation serves both jobs, and each workspace holds only the work that belongs to it.

EclipseinstallationCoursework workspaceCoursework projectsprojects in the courseworkworkspaceSeparate projectworkspaceOwn projectproject in the otherworkspaceselects one at startupselects one at startupcontainscontains
How does a workspace relate to the projects stored inside it, and how do multiple workspaces keep them separate? One installation can select either workspace at startup, and each workspace contains its own projects.

Reading the Window as Sections and Views

The Eclipse graphical user interface is best understood as one large window that has been divided into several sections. Each section is not empty space waiting to be filled; it holds one or more views. A view is the component that actually shows you something. Read the picture from the outside in: the window contains sections, and each section contains views.

Eclipse windowSection oneText editor viewshows source codeSection twoI/O viewprogram input and outputProject list viewlists workspace projectscontainscontainscontainscontainscontains
How is the Eclipse window divided into regions, and which views sit inside each region? The window is divided into sections, each holding one or more views. This arrangement is one possible example; the source does not fix which view appears in which section.

It helps to think of views as specialist panels. A text editor view shows the source code you are writing. An I/O view is the place where a running program can read input and write output. A project list view shows the projects that the workspace contains. Because each view has a different job, the window needs several of them at once, and that is why it is divided into sections in the first place.

A view displays one type of information. Where several views share a section, tabs are used to switch between them. So a section is a region of the window, a view is the panel inside that region, and a tab is how you move from one view to another within the same region.

Tracing a Session from Launch to Editing

Follow one session from start to finish. The steps below put together the workspace choice and the window structure you have just read about.

  1. 1
    You start Eclipse and it asks you to specify a workspace.
  2. 2
    You choose a workspace; its contents are the ones shown for this session.
  3. 3
    The window opens, divided into sections.
  4. 4
    The text editor view in one section shows the source code of your program.
  5. 5
    The project list view in another section shows the projects the workspace contains.
  6. 6
    When you run your program, its input and output happen in the I/O view.

Perspectives as Groups of Views

The word perspective is easiest to grasp as a grouping. Views are the individual panels; a perspective is one arrangement of those panels that suits a particular job. A perspective is the whole set of views in the window. Changing perspective therefore changes which views make up the window, which in turn changes what the window is good for at that moment.

TermWhat it isExample from the source
ViewA single panel that displays one type of informationA text editor, an I/O area, or a project list
SectionA region of the window that holds one or more viewsA region that can hold a text editor view alongside tabbed views
PerspectiveThe whole set of views in the window, arranged for a jobThe Java Perspective, or the Debug Perspective

Views, sections, and perspectives at a glance

What do you think happens?

Which perspective does Eclipse use for compiling and running programs?

  • The Debug Perspective

  • The Java Perspective

  • The I/O Perspective

  • The project list view

Reveal answer
Answer:

The Java Perspective

The source states that the Java Perspective is the default for compiling and running. The Debug Perspective is a different perspective, used to help find semantic errors.

Why Switch to the Debug Perspective

The Java Perspective is the default arrangement for compiling and running. The Debug Perspective is a different arrangement of views, and the source describes its purpose as helping to find semantic errors. This is the reason an experienced programmer might move to it: when the everyday arrangement is not enough to locate a problem, a perspective built around finding errors gives a more suitable set of views.

Mistakes Beginners Make with Workspaces and Perspectives

  • Common mistake

    Accepting a vague default workspace name without thinking about it

    Why it fails

    The workspace is the directory where your work is kept, so the name tells you where to look later.

    Do this instead

    Pick a name that identifies the work, such as the course or project it holds.

  • Common mistake

    Assuming Eclipse allows only one workspace

    Why it fails

    A single installation can use multiple workspaces and select one at startup.

    Do this instead

    Create separate workspaces for separate kinds of work and choose the right one when Eclipse starts.

  • Common mistake

    Treating a view and a perspective as the same thing

    Why it fails

    A view is one panel showing one type of information; a perspective is the whole set of views arranged for a job.

    Do this instead

    Think of views as panels and a perspective as the arrangement of those panels.

  • Common mistake

    Expecting the Debug Perspective to be the one used for compiling and running

Practice: Plan Your Workspaces

EASY

You will use Eclipse for a programming course and for a personal project. Describe how you would set up your workspaces at startup so the two kinds of work stay separate, and state which perspective you would expect to use for compiling and running your programs.

Hints
  • Recall that a single installation can use several workspaces, and that you select one at startup.
  • Recall which perspective the source names as the default for compiling and running.

Key Takeaways

  • A workspace is the directory where your work is stored, and Eclipse asks you to specify one the first time you start it.
  • A single Eclipse installation can use multiple workspaces, and you select the one you want at startup.
  • The Eclipse window is one large window divided into sections, and each section holds one or more views.
  • A view shows one type of information, while a perspective is the whole set of views arranged for a job.
  • The Java Perspective is the default for compiling and running, and the Debug Perspective helps find semantic errors.