Review: The big 4 Java IDEs compared
How Eclipse, NetBeans, JDeveloper, and IntelliJ IDEA stack up in capabilities and ease of use
- A built-in Java decompiler. This is extremely useful when you're working with a third-party library and you don't have the source. (NetBeans and Eclipse have third-party decompiler plug-ins.)
- Improved support for Java 8. For example, the expression evaluator in the debugger can now handle lambda expressions.
- The "scratch files" feature. This lets you open what amounts to a temporary file -- one that doesn't become part of your project, but goes away when you close it. You can select what sort of code you're writing in the scratch file -- Java, JavaScript, HTML, and so on -- and IDEA will provide all the coding assistance it provides in "normal" files. With a "scratch file," you prototype on the fly, with all of IDEA's coding capabilities available, and not "pollute" workspace.
- A JavaFX scene builder that runs in the IDE. In previous versions, you had to configure the IDE to start the scene builder as a separate process.
This latest version of IDEA also improves support for the Gradle and Maven build tools, as well as the Mercurial and Git version control systems. (IDEA already had support for Mercurial and CVS.) In addition, it supports current versions of the WildFly (formerly JBoss), TomEE, GlassFish, and tc Server application servers.
IDEA is available in two editions: the free Community edition and the paid-for Ultimate edition. Personal and academic licenses are available for the Ultimate edition. JetBrains also provides discounts for software startup companies. You can see a matrix of the differences between the two editions on the JetBrains website.
The Community edition supports Java, Groovy, Scala, and Clojure. With the help of a plug-in, IDEA supports Dart, a language with a C-like syntax that compiles to JavaScript and is meant to, ultimately, become JavaScript’s replacement in the Web browser. The Community edition also supports XML editing, as well as XSD (XML Schema Definition) and DTD (Document Type Definition).
Purchase the Ultimate edition, and you add support for HTML, CSS, and JavaScript, as well as SQL, Ruby, Python, and PHP. Again, a free plug-in is required to enable some languages. Unhappily, if you intend on doing Java EE development in IDEA, you'll need the Ultimate edition, as only it provides support for servlets, JSP (JavaServer Pages), JSF, JPA and Hibernate, and frameworks like Grails and Rails.
As with the other IDEs, IDEA's capabilities can be extended via numerous plug-ins. The entries in the JetBrains plug-in repository are scored (like an Amazon product). Examples include database navigators, plug-ins for Haskell language support, numerous Android extensions, extensions for Groovy, and even a plug-in that displays the current "Dilbert" cartoon. Some plug-ins are available only for the Ultimate edition, but even the Community edition has plenty of extensions to choose from.
Working with IntelliJ IDEA
Like the other IDEs, IntelliJ IDEA can build a wide variety of projects, including plain old Java SE applications, Java EE components, Spring applications, and Java FX applications. (The range available depends on the version you're using; some project types are not available in the Community edition.) If you want to create mobile applications, IDEA supports J2ME and Android projects. (You need to download and install the Android SDK to build an Android project.) You can use IDEA's build system, create a Gradle project, or request the IDE to generate an Ant build.
When entering source code with IDEA, you'll find all the expected code completion tools. In fact, this is an area where IDEA really shines: The JetBrains engineers have added unique innovations that reduce the number of keys you have to type to produce a line of code. For example, IDEA's “postfix completion” is a feature you'll find nowhere else.
It works like this: While in the editor, you type, say, a variable name, then append to that name a postfix identifier preceded by a period (.). The editor will automatically rewrite that variable, wrapped in a Java expression. For example, if you type a reference to an object, then append the postfix expression with .null
, the editor will rewrite the line to be an if
statement of the form if (object == null)
, complete with curly braces and ready for the body of the if
clause.
Database tools are an important adjunct to Java desktop and server application development, and IDEA provides a good collection of such tools. There's a database browser, an SQL query editor (that supports code completion), and a table editor. Of course, IDEA supports all the primary RDBMSes, plus any database for which a JDBC driver is available. As in the source editor, IDEA provides plenty of handy shortcuts in the database tools. For example, rather than crafting a query to see what a foreign key in a particular database table references, you can simply select the key in the database browser and press Ctrl-Q, which opens a pop-up that displays the referenced data.
When you're working with SQL code in the Java editor, IDEA is intelligent enough to provide code completion for the SQL (which is surprising, considering that as far as Java is concerned the SQL statements are merely strings). You can also select the dialect of SQL that you will use, which is helpful in catching differences between, say, DB2 and HSQLDB. Even better, if you've set up a connection to your database, you can test a query directly, and the IDE will prompt for those parameters that require values.
The one downside to all of this is the fact that the database tools are available in the Ultimate edition only.
IntelliJ IDEA provides a graphical view of class inheritance and containment. Toward the bottom of the screen, the Inspection Analyzer view identifies potential runtime problems.
IDEA has an apparently limitless array of tool windows, all designed to simplify otherwise tedious development chores. For example, the Code Inspection Tool window will examine code and identify problematic constructs, even misspellings. This is one of the many analysis tools available, which include module dependencies analysis and data flow analysis, where you can discover the source of data for a particular variable, possible values for a variable, and potential NullPointerException
sources.
JetBrains has outfitted the IDEA debugger with useful innovations, too. Even if debug information is not available for a particular class or method, the debugger can deduce which local variable is allocated to which “slot” in the stack. This helps with tracking down issues when the execution flow might otherwise disappear into a library for which you don't have the source. Even in cases where IDEA cannot know which variable is associated with a slot (such cases occur when a single slot is reused within the body of the method) it’s smart enough to tell you that the slot’s contents “might be this variable or that variable.”
Also, sometimes when you're debugging, you'll step into a single line that has multiple method calls, and you want to step into the second method that will be called, not the first. Press Shift-F7. You’re given a list of methods on the line, and you can choose which one to step into. This is called Smart Step-in, and it works with anonymous classes and Java 8’s lambda expressions.
IntelliJ IDEA help and documentation
While IDEA's online documentation is quite good, once again the IDE's inventiveness is apparent. For example, Find Action helps you quickly locate an operation in the IDE. Enter “open," and IDEA will display all the actions that pertain to opening (or importing) in a list dialog. You can activate your chosen activity from the results list.
Then there's IDEA's Productivity Guide. On the one hand, this is a quick-reference card to productivity-enhancing features in the IDE. Click on a feature, and you’re shown a brief example of what that feature entails. But the guide also shows usage statistics -- how many times you've used a particular feature in the IDE. Why is this good? Because it also shows you similar features. If you use a certain feature a lot, you can check related features you perhaps didn't know about, examine them via the examples, and determine if the related features are better than the one you've been using so much.
IntelliJ's IDEA Community edition is an excellent all-around Java IDE. If you do scripting work with Groovy, its Groovy support is particularly good. You also get support for Scala. In terms of usability, Community edition falls somewhere between NetBeans and Eclipse.
Opt for the Ultimate edition, and you have yourself a powerful development platform that includes the database tools, the support for J2EE and application servers, JPA and Hibernate support, editors for JavaScript, HTML, and CSS, and more.
IDEA's true power is in its ever-expanding set of useful productivity enhancements. I've watched developers skilled in the use of IDEA fly through programming tasks in a fraction of the time those tasks would otherwise take. We can only hope that the other IDE engineering teams are studying IntelliJ's features and incorporating their ideas -- or, better yet, improving on them. In that way, all Java developers will benefit.
Choose your workbench
For reasons of space and time, much was not covered in this review. With the exception of JDeveloper, the other IDEs can serve as development platforms for multiple languages. Closer to home, all of the IDEs support -- to one degree or another -- Android and mobile device development. While Android does not support the Java SE or Java EE APIs, the language of Android is Java. Some of the IDEs provide profiling tools that let you home in on the performance bottlenecks of your application.
Beyond those issues, all of the IDEs in this review can be extended via plug-ins. New plug-ins mean new capabilities. As already stated, the number of plug-ins available for Eclipse alone would require several hundred Web pages of material simply to describe briefly.
It would be foolhardy to recommend one IDE above all of the others, partly because they all have common capabilities and partly because IDEs arouse the same sort of zealotry you'll find when you argue about editors. For each of the IDEs in this review, I have encountered at least one engineer who has told me that they swear by it, and that engineer has presented a list of reasons why they do ... and those reasons were all good ones.
Nevertheless, broad suggestions are possible. If you're new to Java, then start with NetBeans or IntelliJ IDEA. NetBeans will take you further if you move into J2EE development. To develop J2EE applications with IDEA will require purchasing the Ultimate edition. However, you might decide that IDEA's productivity enhancements are worth the cost.
If you need to work across technologies -- database, JavaScript, XML, HTML, report generation -- then Eclipse and its unending supply of add-ons might be your best bet. You'll need to invest the time to learn "the Eclipse way," but the range of capabilities you can commandeer from within a single IDE will be formidable. But beware the potential for chaos.
If you're a J2EE developer who battles databases daily, JDeveloper might be the best choice to see you through the hard times. On a past project, I used JDeveloper to reverse-engineer a database that consisted of hundreds of tables and an unfathomable number of relationships. The database tools in JDeveloper allowed me to tame what would otherwise have been an insanity-inducing mess.
Finally, there is the liberating fact that these are all free tools (not counting IDEA's Ultimate edition). That means the only obstacle standing between your project and the IDE that will bring it under control is a download and an installation.
This story, "Review: The big 4 Java IDEs compared" was originally published by InfoWorld.
Copyright © 2015 IDG Communications, Inc.