JB Header

Choosing a Java IDE: IntelliJ IDEA vs Eclipse vs VS Code

Introduction You can write Java in any text editor and compile it from the command line, but almost every Java developer uses an IDE (Integrated Development Environment). This tutorial compares the three most popular Java IDEs - IntelliJ IDEA, Eclipse and Visual Studio Code - and helps you choose one. We will start with what an IDE does for you. We will then look at each of the three IDEs, compare them side by side, and see how to create and run a first program in each. Lastly, we will look at the keyboard shortcuts which save the most time.

(Note - An IDE needs a JDK to compile and run your code. If you have not installed one yet, follow How to Install the JDK and Set JAVA_HOME and PATHClick to read tutorial: How to Install the JDK and Set JAVA_HOME and PATH first.) What does an IDE do for you? An IDE combines an editor, the compiler, a debugger and many other tools into one program. For Java, a good IDE gives you -
  • Code completion: Suggests class names, methods and variables as you type, so you do not have to remember every method of every class.
  • Errors as you type: Compile errors are underlined in red while you write, instead of when you run javac, and many come with one-click quick fixes.
  • One-click run and debug: Compile and run a program with a single click. The debugger lets you pause a running program, step through it line by line, and look at the values of variables.
  • Refactoring: Rename a class or method, or move code around, and the IDE updates every place that uses it.
  • Project and build tool support: Works with Maven and Gradle projects, version control such as Git, and unit tests.
Note - While you are learning, it is still worth compiling and running a few programs from the command line with javac and javaClick to read tutorial: Compiling and Running Java Programs with javac and java, so that you understand what the IDE does behind the scenes. IntelliJ IDEA IntelliJ IDEA, made by JetBrains, is the most widely used Java IDE today. It is known for its very smart code completion, deep understanding of Java code, and excellent refactoring tools.

IntelliJ IDEA has a free tier which covers everything you need for core Java - which is all of this Java Fundamentals series - and a paid Ultimate tier which adds support for enterprise frameworks such as Spring and Jakarta EE, databases and web development. It runs on Windows, macOS and Linux, and can even download a JDK for you when you create a project. Android Studio, Google's IDE for Android apps, is also built on IntelliJ IDEA.
Eclipse Eclipse is a free, open-source IDE from the Eclipse Foundation, and was the most popular Java IDE for many years. It is still widely used in companies, especially on older projects. Download the package named Eclipse IDE for Java Developers.

Eclipse organizes your projects into a workspace folder, and can be extended with thousands of plugins. It has its own incremental Java compiler, so it shows errors immediately as you type. Many companies build their own internal tools on top of Eclipse. Visual Studio Code Visual Studio Code (VS Code) is a free, lightweight code editor from Microsoft which supports many languages. It becomes a capable Java IDE once you install Microsoft's Extension Pack for Java, which adds Java language support, debugging, testing, and Maven and Gradle support.

VS Code starts quickly and uses less memory than a full IDE. It is a good choice if you already use it for other languages such as JavaScript or Python, or if you want a simple editor while learning. For large Java projects, its refactoring and analysis are not as deep as IntelliJ IDEA's.

Note - Apache NetBeans is another free, open-source Java IDE, and a simple, beginner-friendly option which works well out of the box. IntelliJ IDEA vs Eclipse vs VS Code - comparison
IntelliJ IDEAEclipseVS Code
Made byJetBrainsEclipse FoundationMicrosoft
CostFree tier for core Java; paid Ultimate tierFree, open sourceFree; Java support through free extensions
TypeFull Java IDEFull Java IDELightweight editor with Java extensions
Code completion and analysisExcellentVery goodGood
RefactoringExcellentVery goodBasic to good
Speed and memoryHeavierMediumLightest
Best forMost Java developers, from beginners to large projectsExisting Eclipse-based teams and pluginsDevelopers who work in several languages

Our recommendation: if you are starting out, use IntelliJ IDEA. It gives the best help while you learn, and it is what most Java teams use. All three are good, however, and the Java you learn is exactly the same in each.
Creating and running your first program The steps are similar in all three IDEs -
  • IntelliJ IDEA: Choose File > New > Project, select Java, pick your JDK, and click Create. Right-click the src folder, choose New > Java Class, and name it FirstProgram. Click the green run arrow next to main() to run it.
  • Eclipse: Choose File > New > Java Project, enter a name and click Finish. Right-click the src folder, choose New > Class, enter FirstProgram, tick public static void main(String[] args) and click Finish. Run it with Run > Run As > Java Application.
  • VS Code: Open a folder, create a file named FirstProgram.java, and type the code. Click Run above the main() method, or press F5.
Here is a program to try. It adds up the numbers from 1 to 10 - a good first program to run, and then to step through in the debugger to watch sum grow.
A first program to run in your IDE
//FirstProgram.java
public class FirstProgram {
  public static void main(String[] args) {
    int sum = 0;
    for (int i = 1; i <= 10; i++) {
      sum = sum + i;
    }
    System.out.println("My first program in an IDE!");
    System.out.println("Sum of 1 to 10 = " + sum);
  }
}
 OUTPUT in the IDE's Run window
My first program in an IDE!
Sum of 1 to 10 = 55
Explanation of the code
  • The for loop runs ten times, adding each number from 1 to 10 to sum. Loops are covered in the for loop tutorialClick to read tutorial: Java for Loop Tutorial with Examples.
  • To debug it, click in the left margin next to the line sum = sum + i; to set a breakpoint, then run the program in debug mode. The program pauses at that line each time round the loop, and the IDE shows the current values of i and sum.
Time-saving shortcuts These shortcuts are for Windows and Linux; on macOS, use Cmd instead of Ctrl in most of them.
  • IntelliJ IDEA: Type psvm or main and press Tab to create a main() method, and sout then Tab for System.out.println(). Ctrl+Space completes code, Alt+Enter shows quick fixes, and Shift+F10 runs the program.
  • Eclipse: Type main or sysout and press Ctrl+Space for the same templates. Ctrl+1 shows quick fixes, Ctrl+Shift+F formats the code, and Ctrl+F11 runs the program.
  • VS Code: Type main or sysout and choose the suggestion. Ctrl+Shift+P opens the command palette, F5 runs with the debugger, and Ctrl+F5 runs without it.
Summary In this tutorial we first saw what an IDE does for you - code completion, errors as you type, running and debugging, refactoring and build tool support. We then looked at IntelliJ IDEA, Eclipse and VS Code, compared them side by side, and recommended IntelliJ IDEA for beginners. Next we saw how to create and run a first program in each IDE, and how to step through it with the debugger. Lastly, we went through the shortcuts which save the most time. In the next tutorial, we will look at the classic Hello World programClick to read tutorial: Java Hello World Program Explained Line by Line line by line.