Skip to lesson

Set up Eclipse for Java

I'm on:

Showing steps for Windows. They are marked “On Windows” below.

Pick one IDE – you only need one. VS Code, IntelliJ IDEA and Eclipse are alternatives for this step: finish any one of them and the step is done. This guide sets up Eclipse.

Install Eclipse

An IDE (Integrated Development Environment) is an app where you write, run and fix code in one window. It shows mistakes as you type and runs your program with one click.

Eclipse is a free, open-source Java IDE. Many colleges use it in labs. Install the JDK first (Install Java (opens in a new tab)).

On Windows

Open the Download Eclipse page using the button above.

  1. Click Download x86_64, then Download on the next page. You get the Eclipse Installer (.exe).
  2. Double-click the .exe file and choose Eclipse IDE for Java Developers.
  3. Keep the default folder and click Install. Accept the licenses when asked.
  4. Click Launch. Next time, open Eclipse from the Start menu.
When Eclipse starts, it asks for a workspace: the folder where it keeps your projects. Keep the default (eclipse-workspace in your home folder) and click Launch. Then close the Welcome tab.

Create a new Java project

A project is a folder that holds all the files of one program. Eclipse can also add module-info.java, which groups code into a module. This first project does not need one, so untick it.

  1. Click File → New → Java Project.
  2. Type the project name HelloApp.
  3. Under Module, untick Create module-info.java file.
  4. Click Finish.

Create a class and run Hello World

Eclipse can write the main method for you when you create a class. This is the class you will make:

Main.javaJava
public class Main {    public static void main(String[] args) {        System.out.println("Hello, World!");    }}
Output
Hello, World!

Follow these steps to create it, then run it.

  1. In the Package Explorer on the left, open HelloApp, right-click src → New → Class.
  2. Type the name Main. Tick public static void main(String[] args). Click Finish.
  3. Inside main, type System.out.println("Hello, World!");. Tip: type sysout and press Ctrl + Space (on Mac too).

On Windows

Now save and run the program.

  1. Save with Ctrl + S.
  2. Right-click Main.java → Run As → Java Application. Or click the green ▶ in the toolbar, or press Ctrl + F11.
  3. The output appears in the Console view at the bottom.
If Eclipse warns that "the use of the default package is discouraged", you can ignore it for now. If a run shortcut does nothing, use Run As → Java Application.

Common problems and fixes

Most problems come from a module file you did not mean to create, or a missing JDK.

  • Errors that mention modules or module-info – this exercise is meant to be a project without a module. First check that module-info.java is in your project by mistake and that the error is about modules. If so, right-click module-info.java → Delete, then run again.
  • "Selection does not contain a main type" – the main line is missing or misspelled. Check it reads public static void main(String[] args) and save the file.

On Windows

Problems seen on Windows:

  • "JRE not found" or "Unbound classpath container" – open Window → Preferences → Java → Installed JREs → Add… → Standard VM. Choose your real JDK folder, for example C:\Program Files\Java\jdk-25 (Oracle) or the folder inside C:\Program Files\Eclipse Adoptium (Temurin), and tick it.

Example

Main.javaJava
public class Main {    public static void main(String[] args) {        System.out.println("Hello, World!");    }}
Output
Hello, World!

What this code does

  • Eclipse wrote the class and the main method. You added the System.out.println line.
  • If you typed a package name in the class window, Eclipse adds a package line at the top. That is fine.
  • Run As → Java Application compiles and runs the class. The output appears in the Console view.

Next step

Practice what you learned

2 small exercises