1. The Eclipse IDE for Java development

The Eclipse IDE (integrated development environment) is one of the leading IDEs for Java development.

You can extend Eclipse with additional software components called plug-ins. Pre-packaged distributions combine a consistent set of plug-ins for a use case. The Eclipse IDE downloads page lists them.

The Eclipse IDE for Java Developers distribution supports standard Java development. It includes support for Maven, Gradle and Git.

Other tools reuse Eclipse components. For example, the Java support of Visual Studio Code uses the Eclipse Java compiler and language server. == Install the Eclipse Java IDE

You can install the Eclipse Java IDE via the installer or via a package download. The installer is usually the easier option.

1.1. Using the installer

Download the installer from https://www.eclipse.org/downloads/.

java ide oomph04

Start the installer depending on your operating system:

  • Linux: extract the downloaded tar.gz archive and run the eclipse-inst executable.

  • macOS: open the downloaded dmg file and start the Eclipse Installer application.

  • Windows: run the downloaded exe file.

Select Eclipse IDE for Java Developers and install it.

java ide oomph10
java ide oomph20

Confirm the license agreements if asked.

java ide oomph30

After the installation, you can start the IDE directly. Note the installation folder, as you start Eclipse from there later.

java ide oomph40

1.2. Using a packaged download

Alternatively, download the Eclipse IDE for Java Developers package from https://www.eclipse.org/downloads/packages/.

Click the link for your operating system and processor architecture next to the package, for example x86_64 or AArch64.

Eclipse Download page

The download is a tar.gz archive (Linux), a dmg file (macOS) or a zip file (Windows). On Linux and Windows, extract it to a local directory. On macOS, open the dmg file and move the application to your Applications folder.

2. Starting to use the Eclipse IDE

To start the Eclipse IDE, double-click eclipse.exe (Windows) or eclipse (Linux) in your installation directory. On macOS, start the Eclipse.app application.

What to do if the Eclipse IDE does not start

The Eclipse IDE for Java Developers package requires Java 25 or later. The installer and the packages bundle a suitable Java runtime, so this only matters if you configure your own JVM.

2.1. Picking a workspace

At startup, Eclipse asks for a workspace directory, in which it stores its configuration.

If you already use Eclipse, select a new workspace to avoid side effects with existing projects. Choose an empty directory and click Launch.

Selecting the workspace directory

The Eclipse IDE starts and shows the Welcome page. Close it via the x on the Welcome tab.

Closing the Eclipse welcome screen

Afterwards, the IDE looks similar to the following screenshot.

Eclipse IDE window after closing the Welcome page

2.2. Appearance

Eclipse uses a light theme by default. To switch to the Dark theme, use the Theme selection in Window  Preferences  General  Appearance.

Changing the theme
Restart the IDE after changing the theme, as some native styling is only applied at startup.

Additional themes are available from the vogella Eclipse Themes project, for example GitHub Dark, Dracula, One Light, Nord and Gruvbox Material. The project also provides new icon sets for the IDE to go with these custom themes. To install them, select Help  Install New Software…​, enter the following update site in the Work with field and press Enter.

https://vogellacompany.github.io/eclipse-themes/

Select the vogella Eclipse Themes feature. If you use Eclipse 2026-03 or later, also select the vogella Theme Icon Sets feature, as older releases cannot install it. Finish the installation and restart the IDE when prompted.

Afterwards, select one of the new themes in the Theme selection of Window  Preferences  General  Appearance. Restart the IDE again, so that it applies the theme and its icon set.

Eclipse IDE with the GitHub Dark theme and its icon set

3. Important Eclipse terminology

3.1. Workspace and projects

The workspace is a directory in which Eclipse stores its metadata, for example preference settings, plug-in data and logs. It can also hold your projects.

You select the workspace at startup or via File  Switch Workspace  Other…​.

Projects can be stored inside or outside the workspace. For example, Git repositories are typically stored outside the workspace.

3.2. Views, editors and perspectives

Eclipse uses views and editors to navigate and change content. A perspective groups views and editors for a specific task.

A view displays and modifies structured data directly. For example, if you rename a file in the Package Explorer view, the file is renamed immediately without saving.

An editor modifies a single data element, for example a text file. To apply the changes, save the editor via File  Save or Ctrl+S. An editor with unsaved changes (a dirty editor) shows an asterisk in front of the file name.

Editor marked as dirty

The available perspectives depend on your installation. For Java development, you mainly use the Java and the Debug perspective. Switch perspectives via Window  Perspective  Open Perspective.

Switching perspectives in the Eclipse IDE

Open editors are shared between perspectives. If you switch from the Java to the Debug perspective, your editors stay open.

The following image shows the Java perspective. The Package Explorer view on the left shows your projects; double-click a file to open it in an editor. Several editors are stacked in the editor area in the middle; switch between them via their tabs. You can move editors and views via drag and drop.

Eclipse Java Perspective

The views to the right of and below the editor area complement the editor. For example, the Javadoc view shows the Javadoc of the selected class or method.

3.3. Resetting and customizing a perspective

You can rearrange a perspective by opening, closing and moving views. To open a view, use Window  Show View  Other…​. The Show View dialog lets you search for a view by name.

Show View dialog

If you closed a view by accident or messed up the layout, restore the original state via Window  Perspective  Reset Perspective…​.

To save your layout as a new perspective, use Window  Perspective  Save Perspective As…​.

Save your perspective configuration

Window  Perspective  Customize Perspective…​ lets you show or hide tool bar and menu entries of the current perspective.

Customize Perspective

3.4. Eclipse projects

An Eclipse project contains source, configuration and binary files that belong together and are built as a unit. A project can have one or more natures assigned, which describe its purpose. For example, the Java nature marks a project as a Java project. The natures are stored in the .project file in the project directory.

4. Auto-save in Eclipse IDE

Eclipse compiles your code automatically, but it does not save your changes by default. Save via File  Save or Ctrl+S (Cmd+S on macOS).

Eclipse can also save all dirty editors automatically after a period of inactivity. Enable this via Window  Preferences  General  Editors  Autosave.

Enabling auto-save in Eclipse IDE
Auto-save is recommended for beginners, as some editors, for example the plug-in manifest editor, apply changes only after you save them.

5. The Eclipse Java perspective

This chapter introduces the main parts of the Java perspective. It is a reference, so feel free to skip it.

5.1. Package Explorer view

The Package Explorer view shows the structure of your projects. Double-click a file to open it in an editor.

You also use it to change the project structure, for example to rename files or to move files and folders via drag and drop. Right-click a file or folder to see the available actions.

Package Explorer

See the chapter Source navigation in the Eclipse IDE for more on the Package Explorer.

5.2. Outline view

The Outline view shows the structure of the source file in the active editor.

Outline View

5.3. Problems view

The Problems view shows errors and warnings. If it is closed, open it via Window  Show View  Problems.

Errors in the problem view

You configure which problems the view shows via its view menu. For example, to show only the problems of the selected project, select Filters…​, clear Show all items and set the scope to On elements in selected projects.

View menu of the Problems view
Filters dialog of the Problems view

Right-click a problem and select Quick Fix to fix it. See the chapter Content Assist and Quick Fix for details.

Quick Fix in the Problems view

5.4. Javadoc view

The Javadoc view shows the documentation of the element selected in the Java editor.

Javadoc View

5.5. Java editor

You change Java source code in the Java editor. Each Java source file opens in its own editor.

Java editor

Right-click the left border of the editor (the ruler) to configure it, for example to show line numbers.

Java editor

6. Create your first Java program

In this section, you create and run a minimal Java application.

6.1. Create a project

Select File  New  Java Project. Enter com.vogella.eclipse.ide.first as the project name and click Finish.

New Java Project Wizard

The new project is shown in the Package Explorer. Expand it and explore its content.

Give the project the same name as its top-level Java package. This makes it easy to find the project that contains a piece of code. This tutorial follows this convention.

6.2. Create a package

Right-click the src folder and select New  Package.

Right-click to create a package

Enter com.vogella.eclipse.ide.first as the name and click Finish.

Create a package Dialog

6.3. Create a Java class

Right-click the package and select New  Class.

Create a new class selection

Enter MyFirstClass as the class name, select the public static void main(String[] args) checkbox and click Finish.

Create a new class selection
If you enter a package that does not exist yet in this dialog, Eclipse creates it.

Eclipse creates the file and opens it in the Java editor. Change the class to the following.

package com.vogella.eclipse.ide.first;

public class MyFirstClass {

  public static void main(String[] args) {
    System.out.println("Hello Eclipse!");
  }
  
}

6.4. Run your application

Right-click the class in the Package Explorer or in the editor and select Run As  Java Application.

Run project

The output is shown in the Console view.

Result of the running application

7. Run Java program outside Eclipse

7.1. Create JAR file

To run the Java program outside the Eclipse IDE, you need to export it as a JAR file. A JAR file is the standard distribution format for Java applications.

Select your project, right-click it, and select the Export menu entry.

Export wizard for Java project

Select JAR file and click the Next button. Select your project, enter the export destination, and a name for the JAR file, for example, myprogram.jar.

Export wizard for Java project
Export wizard for Java project

Click the Finish button. This creates a JAR file in your selected output directory.

7.2. Run your program outside Eclipse

Open a command shell, e.g., on Microsoft Windows, select Start  Run, type cmd, and press the Enter key. This should open a console window.

Switch to the directory that contains the JAR file by typing cd path. For example, if your JAR is located in c:\temp, use the following command.

cd c:\temp

To run this program, include the JAR file in your classpath. The classpath defines which Java classes are available to the Java runtime. You can add a JAR file to the classpath with the -classpath option.

java -classpath myprogram.jar de.vogella.eclipse.ide.first.MyFirstClass

Type the above command in the directory you used for the export, and you will see the "Hello Eclipse!" output in your command shell.

Running application outside Eclipse

8. Exercise: Java project, packages and import statements

8.1. Create the project

Create a Java project called com.vogella.ide.counter with the following packages:

  • com.vogella.ide.counter.util

  • com.vogella.ide.counter.main

8.2. Create the classes

Create the following Counter class in the com.vogella.ide.counter.util package.

package com.vogella.ide.counter.util;

public class Counter {
  public int count(int x) {
    // TODO check that x > 0 and <= 255
    // if not, throw a RuntimeException, for example:
    // throw new RuntimeException("x should be between 1 and 255");

    // TODO calculate the sum of the numbers from 1 to x
    // for example, if x is 5, calculate 1 + 2 + 3 + 4 + 5

    // TODO return your calculated value instead of 0
    return 0;
  }
}

Create the following Tester class in the com.vogella.ide.counter.main package. The editor marks an error, because the import statement for Counter is missing.

package com.vogella.ide.counter.main;

public class Tester {

  public static void main(String[] args) {
    Counter counter = new Counter();
  }
  
}

Right-click in the editor and select Source  Organize Imports to add the missing import.

Adding import statements with the Java editor
Selecting import statements with the Java editor

The error disappears. Complete the Tester class.

package com.vogella.ide.counter.main;

import com.vogella.ide.counter.util.Counter;

public class Tester {

  public static void main(String[] args) {
    Counter counter = new Counter();
    int result = counter.count(5);
    if (result == 15) {
      System.out.println("Correct");
    } else {
      System.out.println("Wrong");
    }
    try {
      counter.count(256);
    } catch (RuntimeException e) {
      System.out.println("Works as expected");
    }
  }

}

Implement the TODO comments in the Counter class.

Run Tester and check that it prints the expected results. Your implementation should work for other input values as well.

9. Exporting and importing projects

9.1. Exporting projects

To share projects, export them via File  Export  General  Archive File and select the projects to export.

Exporting project
Exporting projects part 2

9.2. Importing projects

To import projects, select File  Import  General  Existing Projects into Workspace. You can import from an archive file, for example a zip file, or from a directory.

Importing projects
Importing projects from archive file

9.3. Exercise: Export and import projects

Export one of your projects to a zip file. Switch to a new workspace via File  Switch Workspace  Other…​ and import the project from the zip file.

10. Source navigation in the Eclipse IDE

10.1. Package Explorer or Project Explorer

You navigate your projects mainly with the Package Explorer or the Project Explorer view. Expand the tree and double-click a file to open it in an editor.

Package Explorer display

The view menu of the Package Explorer lets you filter which resources are shown.

Filter in the package explorer
Filter in the package explorer

The Package Explorer can select the file of the active editor. For example, if you switch from the editor of Foo.java to the editor of Var.java, the view selects Var.java.

To activate this, click the Link with Editor button in the view’s tool bar.

Synchronize the package explorer selection with the current selected editor

10.3. Opening a class

To open the class under the cursor in an editor, press F3. To open any class by name, press Ctrl+Shift+T and enter the class name.

Opening a class

You can include the package in the search. End each package segment with a . so that the Open Type dialog recognizes it as a package.

Each segment can be abbreviated. For example, org.eclipse.swt.widgets.Button, o.e.s.w.Button and o.Button all find the org.eclipse.swt.widgets.Button class.
Opening a class with package name

The dialog also supports camel case search. For example, OTL or OToList finds the OnTouchListener class.

Opening a class with camel-case
Add a space after the name to match it exactly. For example, Selection ` matches `Selection, but not SelectionListener. Wildcards like * are also supported.

10.4. Open Resource dialog

To open any file of your open projects, press Ctrl+Shift+R and enter the file name. The following screenshot shows how to open a pom.xml file.

Open resources in Eclipse

10.5. Quick Outline

Ctrl+O opens the Quick Outline of the file in the editor. For a Java class, it lists the fields and methods and lets you filter them. Press Ctrl+O again to include inherited members.

10.6. Type hierarchy

The type hierarchy shows the superclasses and the implemented interfaces of a class. Right-click in the editor and select Open Type Hierarchy (F4) or Quick Type Hierarchy (Ctrl+T).

Search  Search…​ (Ctrl+H) opens the search dialog. The File Search tab searches for text, optionally with regular expressions, and can replace the matches.

Text search

Eclipse selects the tab that fits the current selection. The Customize…​ button lets you choose the visible tabs. The Remember the last used page option makes Eclipse open the tab you used last.

Customize search
Customize search

The Java Search tab of the same dialog searches for Java elements, for example methods or types.

Text search

The Search view shows the results. Double-click a result to jump to it in the editor. An arrow in the left border of the editor marks the selected result.

Text search

10.9. Searching in an editor

Ctrl+F opens the find and replace bar in the active editor.

Ctrl+J starts an Incremental Find, which searches while you type and shows the search term in the status line. Press Ctrl+J again to jump to the next match.

Incremental search

With text selected, Ctrl+K jumps to its next occurrence and Ctrl+Shift+K to the previous one.

10.10. Annotation navigation

The Next Annotation and Previous Annotation tool bar buttons jump to the next or previous error or warning in the editor. The shortcuts are Ctrl+. and Ctrl+,.

Annotation navigation

The following screenshot shows code with two warnings and one error.

Moving in the source code

The drop-down menu of these buttons configures which annotation types they visit.

Annotation navigation

10.11. Mouse and keyboard navigation

Hold Ctrl and click the name of a class or method to jump to its declaration. F3 does the same for the element under the cursor.

The breadcrumb bar shows the position of the cursor at the top of the Java editor and lets you navigate from there. Right-click in the editor and select Show in Breadcrumb to activate it.

Show in Breadcrumb
Breadcrumb view

To hide it again, right-click a breadcrumb entry and select Hide Breadcrumb.

Breadcrumb view

10.13. Shortcuts

The appendix lists many navigation shortcuts. Window  Preferences  General  Keys shows all shortcuts and lets you change them.

10.14. Closing and opening projects

Eclipse ignores closed projects: searches skip them and the Problems view does not show their errors. Closing projects you do not work on saves memory and build time.

To close a project, right-click it and select Close Project. Close Unrelated Projects closes all projects the selected one does not depend on. To open a closed project, double-click it or select Open Project from its context menu.

The filter of the Package Explorer can hide closed projects.

11. Content Assist and Quick Fix

11.1. Content assist

Content assist provides context-sensitive code completion in an editor. Press Ctrl+Space to invoke it.

For example, type syso in a Java editor and press Ctrl+Space. Eclipse replaces syso with System.out.println();.

To see the methods of an object, for example person of type Person, type person. and press Ctrl+Space.

Content assist

11.2. Quick Fix

Eclipse underlines problems in the editor and shows a marker in the left ruler and in the Problems view. Place the cursor on the underlined text and press Ctrl+1 to see suggestions for fixing the problem. This is called Quick Fix.

For example, type myBoolean = true; in a method. If myBoolean is not defined, Eclipse marks the statement as an error. Select the variable and press Ctrl+1. Eclipse suggests to create a field or a local variable.

Quick Fix for an undefined variable

Quick Fix can create variables, fields, methods and classes, surround code with try-catch, assign an expression to a variable and much more. It also offers changes for code without errors, for example converting a local variable to a field. === Exercise: Convert anonymous inner classes to lambda expressions and vice versa

The Eclipse IDE has full support for modern Java versions. This section demonstrates the quick fix for converting anonymous inner classes to lambda expressions.

package com.vogella.eclipse.ide.java8;

public class Java8Example {

    public static void main(String[] args) {
        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                System.out.println("Hello Lambdas");
            }
        };
        
        new Thread(runnable);
    }
}

You can use a quick fix for the conversion as demonstrated via the following screenshots.

convertannoymoustolambda10
convertannoymoustolambda20
convertannoymoustolambda30

12. Generating code

Eclipse can generate code for you, for example constructors, getters and setters, toString(), hashCode() and equals(). It can also override methods from a superclass. You find these options in the Source menu.

Source menu

To try it, create the following class in the com.vogella.eclipse.ide.first project.

package com.vogella.eclipse.ide.first;

public class Person {
  private String firstName;
  private String lastName;
  
}

Select Source  Generate Constructor using Fields…​, select both fields and press Generate.

Generate Constructor using Fields dialog

Select Source  Generate Getters and Setters…​, select all fields and press Generate.

Select Source  Generate toString()…​, select all fields and press Generate.

The class now looks like the following.

package com.vogella.eclipse.ide.first;

public class Person {
  private String firstName;
  private String lastName;

  public Person(String firstName, String lastName) {
    super();
    this.firstName = firstName;
    this.lastName = lastName;
  }

  public String getFirstName() {
    return firstName;
  }

  public void setFirstName(String firstName) {
    this.firstName = firstName;
  }

  public String getLastName() {
    return lastName;
  }

  public void setLastName(String lastName) {
    this.lastName = lastName;
  }

  @Override
  public String toString() {
    return "Person [firstName=" + firstName + ", lastName=" + lastName
        + "]";
  }

}

13. Exercise: Code generation and content assist

In this exercise, you practice code generation and content assist.

13.1. Create the project and the class

Create a Java project called com.vogella.ide.todo. Create the com.vogella.ide.todo package and the following class.

package com.vogella.ide.todo;

import java.util.Date;

public class Todo {
  
  private long id;
  private String summary = "";
  private String description = "";
  private boolean done = false;
  private Date dueDate;

} 

Generate a constructor using all fields via Source  Generate Constructor using Fields…​. Generate getters and setters for all fields via Source  Generate Getters and Setters…​.

The class should now look like the following.

package com.vogella.ide.todo;

import java.util.Date;

public class Todo {
  
  private long id;
  private String summary = "";
  private String description = "";
  private boolean done = false;
  private Date dueDate = new Date();

  public Todo(long id, String summary, String description, boolean done, Date dueDate) {
    this.id = id;
    this.summary = summary;
    this.description = description;
    this.done = done;
    setDueDate(dueDate);
  }

  public long getId() {
    return id;
  }

  public void setId(long id) {
    this.id = id;
  }

  public String getSummary() {
    return summary;
  }

  public void setSummary(String summary) {
    this.summary = summary;
  }

  public String getDescription() {
    return description;
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public boolean isDone() {
    return done;
  }

  public void setDone(boolean done) {
    this.done = done;
  }

  public Date getDueDate() {
    return dueDate;
  }

  public void setDueDate(Date dueDate) {
        this.dueDate = new Date(dueDate.getTime());
    }

}

Generate a toString() method based on the id and summary fields via Source  Generate toString()…​. Generate hashCode() and equals() based on the id field via Source  Generate hashCode() and equals()…​.

13.2. Create instances

Create the following TodoProvider class.

package com.vogella.ide.todo;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class TodoProvider {
  private static int current = 0;

  // example data, change if you like
  public static List<Todo> createInitialModel() {
    List<Todo> list = new ArrayList<>();
    list.add(createTodo("Eclipse", "Learn the shortcuts"));
    list.add(createTodo("Java", "Try records"));
    list.add(createTodo("JUnit", "Write a test"));
    list.add(createTodo("Maven", "Build the project"));
    list.add(createTodo("Git", "Commit the changes"));
    return list;
  }

  private static Todo createTodo(String summary, String description) {
    return new Todo(current++, summary, description, false, new Date());
  }
}

13.3. Write a test class

Create a TodoProviderTest class with a main method. In it, call TodoProvider.createInitialModel() and check that it returns 5 items. If not, throw a RuntimeException. Otherwise, print "Correct" to the console.

Type syso and use content assist to create the System.out.println() statement.

syso completed to System.out.println()

13.4. Solution

package com.vogella.ide.todo;

import java.util.List;

public class TodoProviderTest {

  public static void main(String[] args) {
    List<Todo> model = TodoProvider.createInitialModel();
    if (model.size() != 5) {
      throw new RuntimeException("size should be 5");
    }
    System.out.println("Correct");
  }

}

14. Refactoring

Refactoring restructures code without changing its behavior. For example, renaming a class or a method is a refactoring.

Eclipse offers many refactorings via the Refactor menu and the context menu of the editor and the Package Explorer. For example, right-click a class and select Refactor  Rename…​. Eclipse updates all references in the workspace.

Rename refactoring in the context menu

The following table lists important refactorings.

Table 1. Refactorings
Refactoring Description

Rename

Renames a variable, method, class or package and updates all references.

Extract Method

Creates a method from the selected code.

Extract Constant

Replaces a literal with a constant and updates all occurrences.

Extract Local Variable

Assigns the selected expression to a new local variable.

Inline

Replaces a variable, method or constant with its content.

Many refactorings are also available via Ctrl+1. Select code and press Ctrl+1 to see the options for the selection. == Exercise: Refactoring

14.1. Preparation

Change the MyFirstClass class to the following.

package com.vogella.eclipse.ide.first;

public class MyFirstClass {

  public static void main(String[] args) {
    System.out.println("Hello Eclipse!");
    int sum = 0;
    for (int i = 1; i <= 100; i++) {
      sum += i;
    }
    System.out.println(sum);
  }
}

14.2. Extract a method

Select the for loop, right-click and select Refactor  Extract Method…​. Enter calculateSum as method name.

Extract Method refactoring

The class now looks like the following.

package com.vogella.eclipse.ide.first;

public class MyFirstClass {

  public static void main(String[] args) {
    System.out.println("Hello Eclipse!");
    int sum = 0;
    sum = calculateSum(sum);
    System.out.println(sum);
  }

  private static int calculateSum(int sum) {
    for (int i = 1; i <= 100; i++) {
      sum += i;
    }
    return sum;
  }
}

14.3. Extract a constant

Select the "Hello Eclipse!" string, right-click and select Refactor  Extract Constant…​. Enter HELLO as name.

Extract Constant refactoring

The string is now a constant.

package com.vogella.eclipse.ide.first;

public class MyFirstClass {

  private static final String HELLO = "Hello Eclipse!";

  public static void main(String[] args) {
    System.out.println(HELLO);
    int sum = 0;
    sum = calculateSum(sum);
    System.out.println(sum);
  }

  private static int calculateSum(int sum) {
    for (int i = 1; i <= 100; i++) {
      sum += i;
    }
    return sum;
  }
}

15. Eclipse Shortcuts

Eclipse provides a lot of shortcuts to work efficiently with the IDE. For a list of the most important Eclipse shortcuts please see Eclipse Shortcuts

16. Using libraries (JAR files)

16.1. Adding a library to the classpath

To manage the classpath of a project, right-click it and select Properties  Java Build Path. The Libraries tab shows the current classpath.

Libraries tab of the Java Build Path

To add a JAR file from your project, for example from a lib folder, right-click it and select Build Path  Add to Build Path. To copy a JAR file into the project, drag and drop or paste it into the folder, or use File  Import…​  General  File System.

This classpath is only known to Eclipse. For builds outside the IDE, use a build system such as Maven or Gradle to manage dependencies.

16.2. Using project dependencies

A project can depend on another project and use its classes. Right-click the project, select Properties  Java Build Path and add the other project on the Projects tab.

Projects tab of the Java Build Path

16.3. Attaching source code to a library

Press F3 on a class name to open the class, or press Ctrl+Shift+T to search for a type. If no source code is attached to the library, the editor shows the class file. Attach the source code to see the source and to debug into it.

Right-click the project and select Properties  Java Build Path. On the Libraries tab, expand the library, select Source attachment and press Edit…​. Enter the path of a source archive or folder.

Source attachment of a library

The JDK ships its source code as lib/src.zip.

16.4. Attaching Javadoc to a library

In the same place, select Javadoc location and press Edit…​. Enter the location of the Javadoc.

Javadoc location of a library

17. Updating Eclipse and installing plug-ins

17.1. The update manager

Eclipse installs and updates software components from update sites. An update site is located on a web server or in the file system. Eclipse downloads only new or changed components.

Behind a proxy, configure it under Window  Preferences  General  Network Connections. Otherwise, Eclipse cannot reach the update sites.

17.2. Updating Eclipse

Select Help  Check for Updates. Eclipse searches the configured update sites for updates of the installed components and asks you to approve them.

17.3. Installing new components

Select Help  Install New Software…​.

Install dialog

Select an update site from the Work with list or enter a new URL. A new URL is added to the list of available update sites. To add an update site with a name, press Add…​.

The official Eclipse components are available from the following update sites.

# a specific release, for example 2026-09
https://download.eclipse.org/releases/2026-09

# the latest release
https://download.eclipse.org/releases/latest

Select the components you want and press Next > to install them.

Components of an update site

If you cannot find a component, clear Group items by category. Uncategorized components are only shown without grouping.

Restart Eclipse after an update or installation to apply the changes.

17.4. Reviewing and uninstalling components

Select Help  About Eclipse IDE and press Installation Details to see the installed components. On the Installed Software tab, you can also uninstall components.

Installation details

18. Eclipse Marketplace

18.1. Using the Marketplace client

The Marketplace client installs components from the Eclipse Marketplace. You can search for components and see descriptions and ratings, without knowing the URL of their update site.

Most Eclipse packages include the Marketplace client. Otherwise, install it via Help  Install New Software…​ from the release update site.

Installing the Marketplace client

Select Help  Eclipse Marketplace…​ to open it.

Eclipse Marketplace client

Use the Find field to search and press Install to install a component.

18.2. Installing your favorites

You can mark components as favorites on the Marketplace website and install them all at once. Log in on the Eclipse Marketplace website with your Eclipse account.

Log in to the Marketplace

Search for a component and press the star icon to add it to your favorites.

Add a favorite

In the Marketplace client, select the Favorites tab and log in.

Favorites tab
Log in from the client

Select the favorites to install and press Install Now.

Install favorites

19. Advanced update manager options

19.1. Installing plug-ins via the dropins folder

If you have a plug-in JAR file but no update site for it, put it into the dropins folder of your Eclipse installation. Eclipse installs it during the next start. If you remove it from the folder, Eclipse uninstalls it during the next start.

Do not change the plugins folder of your installation directly.

19.2. Exporting and importing installed components

You can export a description of your installed components to a file and install the same components into another installation from it. This keeps several installations in sync.

To export, select File  Export…​  Install  Installed Software Items to File and select the components.

Export installed software items

To install from such a file, select File  Import…​  Install  Install Software Items from File and select the components to install.

19.3. Installing features via the command line

The director application installs features from the command line. The following command installs EGit and EMF into the Eclipse installation in the eclipse folder.

eclipse/eclipse \
-application org.eclipse.equinox.p2.director \
-noSplash \
-repository \
https://download.eclipse.org/releases/2026-09 \
-installIUs \
org.eclipse.egit.feature.group,\
org.eclipse.jgit.feature.group,\
org.eclipse.emf.sdk.feature.group

The ids of the features are shown in the installation dialog of the update manager.

Feature ids in the installation dialog

20. Eclipse preference settings

20.1. What are preferences?

Eclipse stores its settings as key-value pairs called preferences. Each Eclipse component defines its own preferences, for example how long content assist waits before it opens, or whether imports are organized on save.

You change preferences in the preference dialog.

20.2. Opening the preference dialog

Select Window  Preferences (Eclipse  Settings…​ on macOS) to open the preference dialog. Use the filter field to find a setting.

Preference settings

Most preferences are stored per workspace, some apply to all workspaces.

20.3. Setting default values with plugin_customization.ini

A plugin_customization.ini file sets default values for preferences. For example, the following line sets a type filter for the java.awt and javax.swing packages.

org.eclipse.jdt.ui/org.eclipse.jdt.ui.typefilter.enabled=java.awt.*;javax.swing.*;

Point to this file with the -pluginCustomization parameter in the eclipse.ini file of your installation. Add the following two lines to eclipse.ini, before the -vmargs line, to use a file in the installation directory.

-pluginCustomization
plugin_customization.ini

20.4. Finding the key of a preference

To find the key of a preference:

  1. Start Eclipse with a new workspace.

  2. Change the preference.

  3. Export all preferences via File  Export  General  Preferences.

  4. Search for the key in the exported file.

Remove the scope, for example /instance/, before you copy a line into plugin_customization.ini.

21. Exercise: Optimizing the Eclipse IDE settings

Eclipse uses conservative defaults to avoid surprises. In this exercise, you change some of them to work more efficiently.

Skip any setting that does not suit you.

Click the Link with Editor button in the Package Explorer view, so that the view always selects the file of the active editor.

Editor

21.2. Insert semicolons at the correct position

Open Window  Preferences  Java  Editor  Typing. In the Automatically insert at correct position section, select Semicolons.

Type Assists that allow setting the semicolon to the right position

If you now type a semicolon in the middle of a statement, Eclipse places it at the end of the statement.

21.3. Escape text pasted into strings

On the same preference page, select Escape text when pasting into a string literal. Eclipse then escapes text that you paste into a string literal. The following example shows the result of pasting HTML into a string.

# paste <a href="tutorials/index.html">Tutorials</a>
# between "" of String s = ""

# results in:
String s = "<a href=\"tutorials/index.html\">Tutorials</a>";

21.4. Highlight enclosing brackets

Open Window  Preferences  Java  Editor and select Enclosing brackets in the Bracket highlighting section.

Highlight the enclosing brackets in JDT

Eclipse then highlights the brackets of the block around the cursor, which shows you in which block you are.

Without highlight the enclosing brackets in JDT
With highlight the enclosing brackets in JDT

21.5. Always launch the previous application

By default, the Run button and Ctrl+F11 start the selected file if it can be run. This can be confusing. To always start the last launched application instead, open Window  Preferences  Run/Debug  Launching and select Always launch the previously launched application.

Launch previous launched application

21.6. Filter unwanted packages with type filters

Organize Imports (Ctrl+Shift+O) adds missing imports. If a type name exists in several packages, Eclipse asks you to choose. The following shows the choices for Date.

Dialog for selecting the correct import statement

To exclude packages you never use, for example AWT or Swing, open Window  Preferences  Java  Appearance  Type Filters. Add Packages…​ adds a package, Add…​ accepts wildcards. The following setting excludes java.awt.* and javax.swing.* from imports, content assist and quick fixes.

Filtering AWT and Swing packages
The dialog only offers packages that are on the classpath of a project in your workspace.

21.7. Format code and organize imports on save

Eclipse can run actions when you save a file. Open Window  Preferences  Java  Editor  Save Actions and select Format source code and Organize imports.

Activating Save Actions
Organize imports on save only adds an import if exactly one type matches. Otherwise, use Source  Organize Imports (Ctrl+Shift+O) and choose. Type filters reduce the number of these cases.

Additional actions and the Configure…​ button let you run more clean ups on save.

Save Actions

21.8. Completion overwrites and guessed arguments

Open Window  Preferences  Java  Editor  Content Assist. Select Completion overwrites and Insert best guessed arguments.

JDT completion

Completion overwrites replaces the rest of the identifier when you accept a proposal in the middle of it. Hold Ctrl while you accept a proposal to use the other mode once.

For example, with the cursor after is in isBlank(), select isEmpty() to replace the call.

Content assist in the middle of a method call

21.9. Content assist on every letter

By default, content assist opens automatically only after a . (dot). To open it while you type any letter, enter .abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ in the Auto activation triggers for Java field on the same preference page.

Auto activation key for code completion

22. Eclipse code checks and cleanup

You can define how the Java compiler reacts to common programming problems. For example, an assignment without effect, such as x = x, can be reported as an error.

22.1. Configuring the compiler checks

Configure these checks in Window  Preferences  Java  Compiler  Errors/Warnings.

Code settings

22.2. Annotation-based null analysis

On the same page, the Enable annotation-based null analysis option turns on null checks based on annotations.

Null annotations

Afterwards, annotate method parameters, return values and fields with @NonNull if they must not be null, and with @Nullable if they may be null. Eclipse then reports code that can violate these contracts.

22.3. Running a clean up

Clean Up applies changes to existing code, from removing trailing whitespace and adding missing @Override annotations to converting code to lambda expressions or to newer Java language features.

Right-click a Java file, package or project and select Source  Clean Up…​.

Source > Clean Up in the context menu

Select Use custom profile and click Configure…​ to choose the clean ups to perform.

Clean Up wizard
Custom Clean Ups dialog
Deselect every clean up you do not want. Commit your code before you run a clean up, so that you can revert changes you dislike.

Click OK and then Next to preview the changes.

Preview of the clean up

23. More on preference settings

This chapter covers more settings that are not specific to Java, and how to share your settings.

23.1. Configuring the editors for a file extension

Window  Preferences  General  Editors  File Associations configures which editors can open a file type. The Default button sets the editor Eclipse uses when you open a file of this type.

To use another editor, right-click the file and select Open With. The available editors depend on your installation.

Open With

Eclipse remembers the editor you last used for a file and opens it with that editor again.

23.2. Export and import preference settings

To transfer your preferences to another workspace, export them via File  Export  General  Preferences. Some preferences can be exported individually, for most you need Export all.

Export your Eclipse preferences.

Import them in the other workspace via File  Import  General  Preferences.

23.3. Project-specific settings

Some preferences can be set per project. Right-click the project and select Properties. For example, on the Java Editor  Save Actions page, select Enable project specific settings to configure the save actions for this project only.

Preference settings per project

Eclipse stores these settings in the .settings folder of the project. Add this folder to version control, so that every developer uses the same settings.

24. Using templates and code formatters

24.1. Templates

Templates are code snippets that you insert via content assist (Ctrl+Space) in the Java editor. For example, if you often write public void name() {} methods, a template can create the method for you.

To create a template, open Window  Preferences  Java  Editor  Templates.

Maintaining code templates

Click New…​ and create the following template with the name npm.

public void ${cursor}() {
}
Creating a new code template

${cursor} places the cursor at this position after the template is inserted.

Type npm in the Java editor and press Ctrl+Space to insert the template.

Using code templates

24.2. Code formatter

The formatter settings define how Eclipse formats your source code. They are located in Window  Preferences  Java  Code Style  Formatter.

Click New…​ to create a profile or Edit…​ to change the selected one.

Code formatter
You can set a formatter for a single project via the project’s Properties. This way, everyone working on the project uses the same formatter.
Code formatter for a project

24.3. Code templates

Eclipse adds comments to code it generates, for example // TODO Auto-generated method stub. Window  Preferences  Java  Code Style  Code Templates defines this generated code.

For example, select Code  Method body, click Edit…​ and remove the TODO comment.

Removing the todos from the Java code templates

25. Exercise: Create a code template

25.1. Create a template for try/catch/finally

Create a template with the name tcf that inserts the following block. ${cursor} places the cursor in the try block.

try {
    ${cursor}
} catch (Exception e) {
    e.printStackTrace();
} finally {
}

25.2. Use the template

Insert your template in the Java editor and check that it works as expected.

26. Eclipse command line configuration

26.1. Eclipse memory settings

The eclipse.ini file in your Eclipse installation configures the Java Virtual Machine (JVM) that runs the IDE. On macOS, it is located in Eclipse.app/Contents/Eclipse. The parameters after -vmargs are passed to the JVM. -Xmx sets the maximum heap size, -Xms the initial heap size.

The following listing shows an eclipse.ini file with 4 GB maximum heap. If you work with large workspaces and your machine has enough memory, increase this value.

-startup
plugins/org.eclipse.equinox.launcher_1.8.0.v20260804-1928.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.2.1600.v20260804-1928
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=25
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-Xms1g
-Xmx4g
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM

You can also pass these options when starting Eclipse from the command line, for example:

./eclipse -vmargs -Xmx4g

26.2. Eclipse startup parameters

The following table lists useful startup parameters. Pass them on the command line or add them to your launcher shortcut.

Table 2. Workspace startup parameters
Parameter Description

-data workspace_path

Starts Eclipse with the given workspace

-showLocation

Shows the workspace directory in the title of the IDE window

For example, the following command starts Eclipse on Windows with the c:\temp directory as workspace.

c:\eclipse\eclipse.exe -data "c:\temp"
The Eclipse help lists all options under "Eclipse runtime options".

27. Local history for files

27.1. Local history

Eclipse keeps a local history of your files. Every time you save a file, Eclipse stores its previous version. You can compare a file with an older version or restore it.

27.2. Compare files with the local history

Right-click a file and select Compare With  Local History…​. Eclipse opens the History view.

Double-click an older version to see the differences in the compare editor.

Local compare view

27.3. Replace files from the local history

Right-click a file and select Replace With  Local History…​ to restore an older version. To restore a deleted file, right-click its folder or project and select Restore from Local History…​.

28. Organizing your workspace with working sets

You will create more and more projects in your development career. Therefore, the data in your workspace grows and it is hard to find the right information. The Eclipse IDE allows you to organize your project into working sets so that you can hide certain resources.

You can use working sets to organize your displayed projects / data. To set up your working set, select the Package Explorer  open the drop-down menu  Select Working Set…​

Showing the working set

Press the New button on the following dialog to create a working set.

Creating new working sets

On the next dialog select Resource, press the Next button. Select the projects you would like to see and give it a name.

Creating new working sets
Creating new working sets
Creating new working sets

You can now filter the displayed files in the Package Explorer based on the created working set.

Filtering resources for the working set

You can use the working set to structure your projects in your workspace. For this, select Working Sets from the context menu of the Package Explorer view.

Structure by working set
Structure by working set

29. Tasks

29.1. Task management

You can place markers in the code which you can later access via the Task view.

You can use // TODO, // FIXME or // XXX tags in your code to add task reminders.

This indicates a task for Eclipse. You find those in the Task view of Eclipse. Via double-clicking on the task, you can navigate to the corresponding code.

You can open this view via Window  Show View  Tasks.

For example, add a TODO to your MyFirstClass class to see it in the Tasks view.

package com.vogella.eclipse.ide.first;

public class MyFirstClass {

  private static final String HELLO = "Hello Eclipse!";

  public static void main(String[] args) {
    // TODO Provide user interface
    System.out.println(HELLO);
    int sum = 0;
    sum = calculateSum(sum);
    System.out.println(sum);
  }

  private static int calculateSum(int sum) {
    for (int i = 0; i <= 100; i++) {
      sum += i;
    }
    return sum;
  }
}

Close the editor for the MyFirstClass class. If you now double-click on the tasks, the Java editor opens again and the TODO comment is selected.

todo10

TIP:The Task view shows only the tasks from the currently open projects.

29.2. Own tags

You can define your own tags in the Eclipse preferences via Window  Preferences  Java  Compiler  Task Tags.

Defining new tasks tags

29.3. Mylyn

A more advanced task management system is available with the Mylyn plug-in.

30. Eclipse online resources

30.1. Documentation

Select Help  Help Contents to open the help for your installed components.

Eclipse help

The help of the current release is also available online at Eclipse online help.

31. Asking (and answering) questions

Good places to ask and answer questions are the Eclipse forums, the GitHub discussions of the Eclipse projects and Stack Overflow. The Eclipse forums require an Eclipse account, Stack Overflow its own account. On Stack Overflow, tag your question, for example with eclipse.

Search for an existing answer before you ask. Stay polite, the Eclipse community values polite behavior. == Eclipse bug reports and feature requests

If you encounter a problem with the Eclipse framework or the IDE, or have an idea for an improvement, report it to the Eclipse project. The Eclipse projects use GitHub issues as the primary issue tracker. To participate actively, you need a GitHub account.

The issues are specific to the GitHub repository of a project. You can search for existing issues there and review them.

The following Eclipse projects use GitHub issues:

32. Next steps

To learn how to debug Eclipse Java programs, you can use https://www.vogella.com/tutorials/EclipseDebugging/article.html - Eclipse Debugging.

To learn Java Web development, you can use https://www.vogella.com/tutorials/EclipseWTP/article.html - Servlet and JSP development. If you want to develop rich standalone Java clients, you can use https://www.vogella.com/tutorials/RichClientPlatform/article.html - Eclipse RCP. You can extend Eclipse with https://www.vogella.com/tutorials/EclipsePlugin/article.html - Eclipse plug-ins.

Good luck in your journey of learning Java.

33. Eclipse Resources

Home Tutorials Training Consulting Books Company Contact us


Get more...