From IntelliJ IDEA to Eclipse and beyond, discover how modern IDEs simplify Java development for beginners and experienced developers alike, offering tools like syntax highlighting, code completion, and powerful project management features.
The Java Development Kit (JDK) can be used to compile and execute Java programs on the command line, although this scenario is not pleasant for development. For this reason, different vendors have put effort in recent years to simplify Java development.
Modern development environments offer the advantage over simple text editors in that they specifically help beginners to the language become acquainted with the appropriate syntax. IDEs, for example, now underline erroneous passages with curly lines much like modern word processors.
In addition, the IDEs provide the necessary help during development, such as syntax highlighting, automatic code completion, access to version management, or even wizards to generate source code for GUIs or web service access with a just few entries. Regarding the distribution of Java IDEs in the wild, the top four are almost always the following IDEs:
JetBrains, a software company based in the Czech Republic, has proven that companies can still earn money with development environments. The Java development environment IntelliJ IDEA (https://www.jetbrains.com/idea) is available in two editions:
The basic version already includes a GUI builder, support for test frameworks, and support for version management systems. The free community version doesn’t provide support for frameworks like Spring or Jakarta EE, and in these cases, adopting the Ultimate Edition is advantageous. Extensions can partially upgrade the free community version in framework support.
JetBrains is a developer of the Kotlin programming language, which is why its support in IntelliJ is ideal. Students and teachers can apply for the Ultimate Edition and get it for free. The differences between these editions are summarized at https://www.jetbrains.com/idea/features/editions_comparison_matrix.html.
The free Community Edition for Windows, macOS, and Linux can be downloaded from https://www.jetbrains.com/idea/download, as can the Ultimate Edition, which can be tested for 30 days.
After downloading, you must run the installation program. The process is self-explanatory.
After starting IntelliJ, you can import existing projects or create new ones. If IntelliJ is started after the installation, a dialog box with the Create New Project selection option appears. Several options are displayed on the left.
Two different approaches to creating projects exist:
The IDE will filled in these coordinates, but you can of course change them.
Clicking Finish completes the project creation.
A Java project needs a proper directory structure, and two approaches to organizing the files exist. The simplest form is to put sources, class files, and resources into one directory. But this mixture is not advantageous in practice.
In general, sources and the translated class files should be separate. Basically, directories could be named and organized in any way, but a common convention exists called the Standard Directory Layout.
Maven divides classes, test cases, and resources into various subdirectories. When the project is compiled, the generated class files end up in the target/classes directory.
Information: Building software and monitoring module dependencies are activities that should happen automatically, not manually. The free and open-source software Apache Maven has become something of a standard in this context. Maven can either be obtained from https://maven.apache.org/ and used as a tool from the command line or can be nicely integrated via the development environment. All major IDEs support Maven out of the box.
To describe projects, Maven uses Project Object Model (POM) files. These files contain the entire configuration and project description, including the name and identifier of the project, its dependencies, its compiler settings, and its license.
The POM file is called pom.xml and is located in the root directory of an application—the file extension signals that this file is an XML file. A Java compiler and the tools no longer need to be called manually with Maven, as the entire control is ultimately carried out by Maven.
When you open the pom.xml file in IntelliJ, note how the generator has placed information about the coordinates and also introduced a properties XML element that determines the Java version number:
<project …>
<modelVersion>4.0.0</modelVersion>
<groupId>…</groupId>
<artifactId>…</artifactId> 1
<version>…</version>
<properties>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
</properties>
</project>
You can manually add another subelement to the properties XML element for encoding, which should always be UTF-8:
<properties>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Tip: If the IDE doesn’t set the version number, or sets it incorrectly, you can always add and change the version manually in pom.xml.
If the context menu on the src folder is activated, select New and then Java Class to open a dialog box where you can enter the class name. Let’s call the class NinetyNineBottlesOfBeer and move on.
In the editor, let’s complete our program:
public class NinetyNineBottlesOfBeer {
public static void main( String[] args ) {
for ( int i = 99; i > 1; i-- ) {
System.out.print( i );
System.out.print( " bottles of beer on the wall, " );
System.out.print( i );
System.out.println( " bottles of beer. Take one down, pass it around," );
}
System.out.println( "1 last bottle of beer on the wall, 1 last bottle of beer."
);
}
}
IntelliJ has no Save button and works automatically in the background. To run the program, click on the green triangle in the line with the main method and start the program.
To replace the old WebSphere series and the Visual Age for Java environment, IBM developed Eclipse (http://www.eclipse.org). In November 2001, IBM released its IDE as open-source software, and later formed a consortium with the Eclipse Foundation to determine further development. Eclipse is licensed under the Common Public License and as open-source software is available to everyone free of charge. Four times a year, an update is published, and the releases are called YYYY-MM (where YYYY stands for the year and MM for the month).
Eclipse makes it possible to integrate tools as plugins. Many vendors have already adapted their products for Eclipse, and development is proceeding at a rapid pace worldwide.
Eclipse is a Java product with a native GUI that does its job quickly and smoothly. The working times are also so fast because Eclipse works with what’s called an incremental compiler. When a user saves a Java source code file, the compiler automatically translates this file. This feature is called autobuild.
The driving force behind Eclipse was Erich Gamma, who went to Microsoft in 2011 and became team leader for VS Code, the new editor with a lean development environment. For web development, VS Code has quickly made friends, and Java development is also possible, although the refactoring capabilities still lag behind Eclipse or IntelliJ. However, VS Code may quickly catch up.
The Eclipse development environment is predominantly programmed in Java and requires at least Java version 8 to run. Since parts like the GUI are implemented in C, Eclipse isn’t 100% pure Java, and care must be taken when downloading to ensure you choose the appropriate system.
Two options for installation on Windows, Linux, and macOS are available:
Eclipse is divided into different packages. For Java developers, the most important packages include the following:
The packages are linked for download at https://www.eclipse.org/downloads/packages.
On the download page, you can find the current version as well as the latest releases. The main versions are called Maintenance Packages. In addition to these packages, stable builds are available, while the brave may consider integration builds and nightly builds, which offer glimpses of upcoming versions. By default, the labels of the development environment are in English, but with Eclipse Language Packs, translations for German, Spanish, Italian, Japanese, Chinese, and other languages are available as are individual updates for the subprojects (WST, JST). The latest releases and builds can be found at http://download.eclipse.org/eclipse/downloads. As of the Eclipse IDE 2021-12, you can develop with Java 17 without any problem and without any additional plugins.
NetBeans is another development environment that had been quite popular. The main development was performed by Sun Microsystems at that time, but when Oracle acquired Sun, development environments were not a big priority in the database company. Further developments did occur, but Oracle dragged on from version to version. Oracle eventually handed over the codebase to the Apache Foundation, thus parting ways with the IDE. The new home is https://netbeans.apache.org.
NetBeans provides convenient Java SE and Java Enterprise development capabilities with editors and wizards for creating GUIs and web applications. Its market share, however, is in the single-digit percentage range.
Editor’s note: This post has been adapted from a section of the book Java: The Comprehensive Guide by Christian Ullenboom.