Choosing your Java IDE

Which Java IDE is best? Compare IntelliJ IDEA , Eclipse, and NetBeans for features, usability, and compatibility with your favorite tools and frameworks.

java -- beans, grounds, coffee -- binary background
Nathan Dumlao (CC0)

Every Java programmer needs a programming editor or IDE that can assist with the grungier parts of writing Java and using class libraries and frameworks. Which editor or IDE will be the best fit for you depends on several things: the nature of your development projects, your role in the organization, your level of programming skills, the processes used by the development team, whether the team has standardized on tools, and, of course, your personal preference.

You would hope that an IDE supports the latest versions of your favorite JVM languages, including Java, Kotlin, Scala, and Groovy. You'd want it to support the most popular application servers and Java frameworks, such as Apache Tomcat, Spring, JavaServer Faces, Struts, GWT (Google Web Toolkit), Play, Wicket, Grails, Dropwizard, ATG, Spark, Hadoop, and Vaadin. A workable IDE should support whatever build and version control systems your group uses, such as Ant, Maven, and Gradle, along with Git, SVN, CVS, Mercurial, and Bazaar. For extra credit, your IDE should be able to handle the client and database layers of your stack, including JavaServer Pages, Embedded JavaScript, TypeScript, and HTML on the client side and Hibernate, JPA, and SQL for the data layer.

Finally, you want a Java IDE that lets you edit, build, debug, and test your systems with ease and grace. Ideally, you’d not only have intelligent code completion but intelligent refactoring and code metrics. If you’re in a shop that does test-driven development, you want support for your testing frameworks and stubbing. If your group uses a ticket system and CI/CD, the IDE should be able to connect to them. If you need to deploy to and debug on containers and clouds, your IDE should help with that.

The three IDEs most often chosen for server-side Java development are IntelliJ IDEA, Eclipse, and NetBeans. These aren’t the only options, however, and we’ll also discuss a few lighter-weight IDEs. For this review, I did fresh installations of IntelliJ IDEA Ultimate 2022.1.1, Eclipse Installer 2022-03 and the Eclipse IDE for Enterprise Java and Web Developers, and NetBeans 13 on a MacBook Pro. I also checked out several open source Java projects, which I used to demonstrate IDE features.

IntelliJ IDEA

JetBrains’ IntelliJ IDEA, the premier Java IDE in terms of both features and price, comes in two editions: the free Community edition, and the paid commercial Ultimate edition. The main distinguishing factors are that the Ultimate edition supports Perforce, ClearCase, and TFS, as well as Git, SVN, Mercurial, and CVS; supports JavaScript and TypeScript; supports Jakarta EE, Spring, GWT, Vaadin, Play, Grails, and other frameworks; and includes database tools and SQL. Recent enhancements to the Ultimate edition include an HTTP client, profiling tools, remote development, and collaborative development.

Version 2022.1 introduces a dependency analyzer, an updated new project wizard, and a notifications tool. It also has improved inlay hints, a new structural search and replace dialog, UML diagram export, a package checker for vulnerability detection, and better support for Java 18 and JUnit 5.

The intent is for the Ultimate edition to earn a place on a professional’s desktop and justify a paid subscription through increased programmer productivity. If a Java developer makes $50-100K per year, it doesn’t take much of a productivity boost to give you a quick ROI on a $500-per-year business IDEA subscription. The price goes down in subsequent years for businesses, is much lower for startups and individuals, and is free for students, teachers, “Java champions,” and open source developers.

JetBrains touts IntelliJ IDEA for deep insight into your code, developer ergonomics, built-in developer tools, and a polyglot experience. Let’s drill down and see what these features mean and how they can help you.

Deep insight into your code

Syntax coloring and simple code completion are a given for Java editors. IntelliJ IDEA goes beyond that to provide smart completion and chain completion. Smart completion means the IDE can pop up a list of the most relevant symbols applicable in the current context, ranked by your personal frequency of use. Chain completion offers a list of applicable symbols that are accessible via methods or getters in the current context. It also completes static members or constants, automatically adding any needed import statements. In all code completions, IntelliJ IDEA tries to guess the runtime symbol type, refine its choices from that, and add class casts as needed.

Java code often contains other languages as strings. IntelliJ IDEA can inject fragments of SQL, XPath, HTML, CSS, and/or JavaScript code into Java String literals. For that matter, it can refactor code across multiple languages; for example, if you rename a class in a JPA statement, IntelliJ IDEA will update the corresponding entity class and JPA expressions.

When you’re refactoring a piece of code, one of the things you typically want to do is also refactor all the duplicates of that code. IntelliJ IDEA can detect duplicates and similar fragments and apply the refactoring to them as well.

IntelliJ IDEA analyzes your code when it loads, and when you type. It offers inspections to point out possible problems (shown in Figure 1) and, if you wish, a list of quick fixes to the detected problem.

IntelliJ IDEA IDG

Figure 1. IntelliJ IDEA now has a dependency analyzer and manager, shown in the bottom panel of the screenshot. It can also pop up all the uses of a variable, as shown in the middle of the upper right window. The loaded project is DeepLearning4j-examples.

Developer ergonomics

JetBrains designed IntelliJ IDEA with flow, aka “the zone,” in mind. The Project tool window at the left in Figure 1 gets out of the way at a mouse click, so you can concentrate on the code editor. Everything you want to do while editing has a keyboard shortcut, including bringing up symbol definitions in a popup window. While learning the shortcuts takes time and practice, eventually they’ll become second nature. Meanwhile, even without knowing the shortcuts, a developer can learn to use IntelliJ IDEA easily and quickly.

The design of the IntelliJ IDEA debugger is especially nice. Variable values show up right in the editor window, next to the corresponding source code, and when the state of a variable changes its highlight color changes as well.

Built-in developer tools

IntelliJ IDEA provides a unified interface for major version control systems including Git, SVN, Mercurial, CVS, Perforce, and TFS. You can do all your change management right in the IDE. As I tested IntelliJ IDEA, I wished that the last change in a source code block would show up in the editor window as an annotation (like in Visual Studio); it turns out that there’s a plugin for that.

IntelliJ IDEA also integrates build tools, test runners, and coverage tools, as well as a built-in terminal window. IntelliJ IDEA now has its own profiling tools, but only in the Ultimate edition.

Debugging Java can be a pain when mysterious things happen in classes for which you have no source code. IntelliJ IDEA comes with a decompiler for those cases.

Java server programming often involves working with databases. IntelliJ IDEA Ultimate includes SQL database tools; a companion tool, DataGrip, is a dedicated SQL IDE, and is available as part of an all-products subscription that’s only a little more expensive than IntelliJ IDEA Ultimate.

IntelliJ IDEA supports all the major JVM application servers, and can deploy to and debug in the servers, fixing a major pain point for enterprise Java developers. IntelliJ IDEA supports Docker through a plugin that adds a Docker tool window. Speaking of plugins, IntelliJ IDEA has a lot of them.

Polyglot experience

IntelliJ IDEA has extended coding assistance for Spring, Java EE, Jakarta EE, Grails, Play, Android, GWT, Vaadin, Thymeleaf, Android, React, AngularJS, and other frameworks. Note that not all of these are Java frameworks. IntelliJ IDEA understands many other languages out of the box, including Groovy, Kotlin, Scala, JavaScript, TypeScript, and SQL. There are currently about 19 IntelliJ language plugins, including R, Elm, and D.

Cost: Organizations pay $499 per user in the first year, with 20% off in the second year and 40% off in subsequent years. Individuals pay $149 per user in the first year, also with 20% off in the second year and 40% off after that. Discounts are available for educational, open source, startups, and other special cases. There is also a 30-day free trial.

Platforms: Windows, macOS, Linux.

Eclipse

Eclipse, long the most popular Java IDE, is free and open source and is written mostly in Java, although its plugin architecture allows Eclipse to be extended in other languages. Eclipse originated in 2001 as an IBM project to replace the Smalltalk-based IBM Visual Age IDEs with one that was portable and Java-based. Another goal was to eclipse Microsoft Visual Studio, hence the name of the project.

Java’s portability helps Eclipse be cross-platform: Eclipse runs on Linux, macOS, Solaris, and Windows. The Java Standard Widget Toolkit (SWT) is at least partially responsible for Eclipse’s look and feel, for good or ill, and the JVM for its performance—or, some say, lack thereof. Eclipse’s reputation for running slowly harks back to older hardware and older JVMs. It can still feel slow, however, when it is updating itself in the background, especially when you have many plugins installed.

Part of the overhead of Eclipse is its built-in incremental compiler, which runs whenever it loads a file and whenever you change code. This is on balance a very good thing, and provides error indicators as you type.

Independent of the build system, an Eclipse Java project also maintains a model of its contents, which includes information about the type hierarchy and references and declarations of Java elements. This is also on balance a good thing, and enables several editing and navigation assistants as well as the outline view.

The current version of Eclipse is 2022-3. I downloaded and ran Eclipse Installer 2022-03 and used it to install the Eclipse IDE for Enterprise Java and Web Developers, then I added the Java 18 plugin. There are many other installation packages, including the option to install the minimal Eclipse SDK and then add plugins as needed. Do note that the last option is not for the faint of heart: it’s not hard to introduce conflicts between plugins that didn’t actually say they were incompatible.

The plugin ecosystem is one of Eclipse’s strengths, as well as being a source of confusion. The Eclipse marketplace contains over 1,500 solutions at current count, but community-contributed plugins may or may not work as advertised. The 1,500-odd plugins include support for over 100 programming languages and almost 200 application development frameworks. The public-domain Java servers are supported: if you define a new server connection from Eclipse, you’ll come to a list of vendor folders, underneath which you’ll find about 14 application servers, including 11 versions of Apache Tomcat. The commercial Java application server vendors used to be listed here, but aren't in the latest Eclipse version by default.

Editing, browsing, refactoring, and debugging

Your first experience with Eclipse can be disconcerting, and even confusing. Eclipse has some unique concepts, such as workspaces, perspectives, and views, the functions of which are determined by what plugins you have installed. For Java server development, you’re likely to use the Java, Java/Jakarta EE, and Java browsing perspectives, the package explorer view, the debugging perspective, a team synchronizing perspective, web tools, a database development perspective, and a database debugging perspective. In practice, all of those start to make sense once you open the views you need.

Eclipse IDE IDG

Figure 2. From left to right, we're seeing the Eclipse project explorer, the data source explorer, the source code editor with an explanatory popup for an annotation, and the class outline. The loaded project is Google Guava, a set of core Java libraries. The panes can be rearranged easily.

There is often more than one way to do any given task in Eclipse. For example, you can browse code with the package explorer and/or the Java browsing perspective. Which you choose is a matter of taste and experience.

Java searching support allows you to find declarations, references, and occurrences of Java packages, types, methods, and fields. You can also use a quick access feature to search, and quick views to pop up things like class outlines.

Adding methods and generating classes are supported by error annotations and content assist. Common code patterns can be generated from code templates, and Eclipse can automatically generate and organize your import statements. Refactoring Java in Eclipse supports 23 operations, ranging from common renaming operations to more obscure transformations right out of Martin Fowler’s book. Refactoring can be done interactively or from refactoring scripts.

Eclipse supports debugging both locally and remotely, assuming that you are using a Java virtual machine that supports remote debugging. Debugging is fairly standard: you typically set breakpoints and then view variables in a tab of the debugging perspective. You can, of course, step through your code and evaluate expressions.

At a Glance
1 2 Page 1
Page 1 of 2