It’s statistic time! Did you know that the average developer spends 76% of their time writing, improving or testing code?1
If you’re going to spend three-quarters of your working week (that’s 30 hours for most of us) writing or debugging code, you should probably try to make that time as productive and enjoyable as possible, right?
This is why most people use an Integrated Development Environment, or IDE, to write code.
An IDE gives you insights about your programs, can sometimes save your ass.
In this article, we’ll see:
when you should use an IDE to write Java
find out the top Java IDEs in use today
give you an opinionated view on the best Java IDE to use!
So let’s get into it.
Java IDE Basics
In this first section, let’s take a look at IDEs in general – what they are, and whether you need one.
What exactly is an IDE?
An IDE, or Integrated Development Environment, is a program which helps you write software. An IDE helps you organise your software projects, write code, and then test and debug it. Popular IDEs include Eclipse, IntelliJ and Microsoft Visual Studio.
An IDE usually includes features which help you to:
Compile or package code
Debug your application
Can an IDE do other things?
Sure! And many of them do.
Some IDEs add features for running tests, writing documentation, and even creating diagrams.
But coding, compiling and debugging are three core features of any decent IDE.
Do you need an IDE to write Java code?
No, you don’t need to write Java code in an IDE. You can use any text editor you like, and then compile the code with
You could be writing code for the Mars rover, nuclear power stations, or even financial trading algorithms, with trusty Windows Notepad, and
javac (the Java compiler command).
I’ve even met Java developers who write code in Vim (the Linux text editor), and then run it all in the Terminal.
And they still write excellent code.
If you’re learning Java, start with a text editor
When you’re a Java beginner, it’s better for your learning to write code using a plain text editor.
It will help you see the basics of the language, and it will help you out in future, because you’ll know exactly how a Java program is created from the ground up.
An IDE is useful once you’re past the beginner stage
But once you’ve moved on from the beginner stage, you will probably benefit from using some kind of graphical desktop program that helps you to write code.
An IDE helps you organise your projects, run tests, compile the code, format it correctly, and much more.
Now you’ve decided you want a Java IDE. That’s why you’re reading this article! (Hi!)
So how do you pick an IDE? What are the features to look for in a good Java IDE?
We’ll look at that next.
Choosing an IDE
If you have the freedom to choose an IDE, then you’re probably wondering what you should look for.
What makes a great Java IDE
A developer’s IDE can be a very personal choice. (I wrote above about the developers who prefer to write code using Vim, the Linux text editor!).
But here’s what I expect any IDE to be:
FAST. It has to be fast. Faster than Speedy Gonzales. Every second you spend waiting for your IDE to process a file, is a second that you might lose concentration, or train of thought.
STABLE. It has to be able to handle multiple editor windows, terminals and build processes simultaneously. And it must handle all of that, without freezing or crashing.
INTELLIGENT. A good Java IDE knows how to take care of boring, repetitive tasks, but it also knows to get out of your way when you just need to write code. You don’t want to battle with wizards and dialog boxes all the time, just give us some sensible default options.
KNOWLEDGEABLE. The IDE should know what good code looks like, and help me avoid code smells – those pieces of code which aren’t great. It should also help me to optimise, by suggesting more succinct alternatives for what I’m writing.
MODERN. Java has traditionally been a slowly-evolving language, but the releases have picked up the pace in recent years, and now we see a new Long-Term Support release of Java every 3 years. Any Java IDE needs to be able to handle the modern features and frameworks of Java 11, 14 and beyond.
ERGONOMIC. This is a fancy way of saying that the IDE should feel great to use.
A great IDE helps you automate boring tasks, but also gets out of the way when you need to concentrate and write code.
Does it matter which IDE you use?
If the code is the same, then does it really matter which IDE you use?
Researchers at Microsoft and the University of Victoria BC conducted a survey of engineers.
The research found that engineers rank poor engineering tools as one of their biggest challenges they face in their job.
It’s a bigger challenge even than things like a bad manager or experiencing too many interruptions.
Challenges like these can affect your job satisfaction and productivity.
So your choice of engineering tool – like an IDE – can make a big difference.
What if I can’t choose my own IDE?
If you’re learning Java in your spare time, then you’ll be free to choose your preferred IDE.
But if you’re starting a job as a Java developer, you should have the freedom to choose your own IDE too.
If they don’t allow you to choose your own IDE, I would challenge it!
You’re going to be spending up to 8 HOURS per day with this application. It needs to help you do great work.
Desktop Java IDEs
The most popular Java IDEs
Some of the top Java IDEs in use today are:
IntelliJ IDEA (including Android Studio)
Visual Studio Code (with the Java Extension Pack installed)
Here’s my review of these 5 Java IDEs:
|IDE||My review||My rating|
|JDeveloper||The “J” is short for “joke”. Crashes constantly, be prepared to lose all your work and leave the office every day, empty and unfulfilled. Only use if it’s forced upon you at gun-point, or via an Oracle license.||★|
|Eclipse||Crashes frequently. Easy to get lost with Perspectives. Slow, just terribly slow.||★★|
|NetBeans||Acceptable, but hasn’t kept up the pace with modern Java developers’ needs.||★★★|
|Visual Studio Code||A solid “good”. Does most of the things you will need. But it’s still just a text editor at heart, with added bells and whistles.||★★★★|
|IntelliJ IDEA||A fast and productive environment to work in. Full insights into your code. First-class debugging, testing, decompiling.||★★★★★|
The best desktop Java IDE: IntelliJ IDEA
After years of trying out each of the different top Java IDEs, I’ve settled on my recommended choice.
The best desktop Java IDE in 2021 is…. IntelliJ IDEA. 🙇♂️
I’ve spent the last 10+ years developing with Java. I’ve tried all the big five – NetBeans, Eclipse, Visual Studio Code, JDeveloper and IntelliJ – and I have not found another desktop IDE that beats IntelliJ for productivity and speed.
- FREE and Open Source - the Community Edition has all you need
- Available for Windows, Mac and Linux
- Fast.... like light-speed fast
- First class support for Maven
- Awesome built-in code inspection, testing, debugging and decompiling tools
- If you're doing Android development, then check out Android Studio -- it's based on the same technology
Why it’s a great choice
Here are some of the features in IntelliJ that make me think it’s the best Java IDE:
Fast global search
Using fuzzy search you can quickly go to any piece of code in your project.
This means less time fiddling around in the project tree, trying to remember where that class went.
You can also use this feature to instantly decompile your dependencies and have a look at the source code.
Just press Left Shift twice to activate global search:
Solid plugin ecosystem
IntelliJ is extensible with plugins. I use the Apache Camel plugin all the time, for example.
But my favourite plugin is the Nyancat plugin. Get a flying rainbow cat in your IDE, While-U-Wait:
Amazing unit test runner
Once you start writing unit tests for your Java applications, and start running them in IntelliJ, you won’t want to run them any other way.
They run quickly, and you can also debug your tests very easily.
Which brings me on to…
Great debugger and decompiler
Once you start creating complex programs, or using external frameworks, you’re going to need a solid debugger and decompiler.
The decompiler allows you to see the source code of the classes you’re using, so you can figure out what’s really going on, in any library you’re using.
In the debugger, you can inspect any object, step forward and back through code lines, and more:
Both of these features are absolutely amazing in IntelliJ, and I would be far less productive if I didn’t have them.
First-class support for Maven
IntelliJ’s support for Maven is great, and specifically the Maven tool window is a blessing for me.
It helps me to visualise all of my dependencies, goals (the “executions” that you run in Maven) and more.
Watch my short video on how to understand a Maven project with IntelliJ IDEA:
In all the years I’ve used it, I’ve had very few crashes. When I use Eclipse, I tend to get poor performance and crashes (sorry Eclipse!)
Automatic code formatting, with sensible defaults
One of the annoying things about other IDEs is that they don’t take a strong stand on code formatting.
Well-formatted code makes it so much easier to share and collaborate with other members of your team!
If code isn’t formatted correctly, you can literally waste time when you’re learning someone else’s codebase. You have to figure out their weird formatting approach, or why some files have been indented with Spaces and some have been indented with Tabs.
(By the way: you make more money if you indent with spaces.)
IntelliJ formats everything as you type, and will even format code you paste from the clipboard.
This is crucial when you’re working as a team. You don’t want to be that developer, whose code everyone else struggles to read because it’s not formatted correctly and looks weird.
Do you need the (paid) IntelliJ Ultimate Edition?
I don’t think you will even need the Ultimate (premium) edition of IntelliJ.
I’ve used the Community (free) edition for 5 years. I’ve never paid for the Ultimate Edition, and I’ve written and debugged code for various platforms like Spring, JBoss, OSGi and more.
The verdict on IntelliJ
I don’t even own a paid licence for IntelliJ IDEA; I use the Community Edition. But I think it is truly the best IDE for professional Java developers.
IntelliJ has helped me become massively more productive as a Java developer. Not only can I write code quicker, but my debugging and problem-solving (which is how I spend a lot of my time) is made much easier too.
The reasons I recommend IntelliJ is because of its speed, stability and awesome testing and debugging features. But primarily because it’s fast and stable. (Did I say it’s stable?)
If you’ve graduated from beginner Java, and you’re looking for an IDE which will support you in writing great Java programs, then you should definitely think about IntelliJ.
Best Java code editor: Visual Studio Code
If you don’t want a full-blown IDE, but you want to be able to write Java code, then there is a decent alternative to IntelliJ IDEA, which comes in second place overall:
It’s Visual Studio Code with the Java Extension Pack.
- Available for Windows, Mac and Linux
- Install the Java Extension Pack to get support for Java linting & refactoring, Maven and debugging support
- Not as feature-rich as IntelliJ, but good for day-to-day coding
I call VS Code a code editor with Java support features, rather than a full-blown Java IDE. This is because, first and foremost, it is a text editor which can be expanded with extensions.
VS Code is great…. but…. it just doesn’t understand Java as well as IntelliJ. What I mean by that is, it doesn’t have the same level of deep understanding of your code, and the whole Java ecosystem.
You can achieve a lot of the same features as IntelliJ by installing plugins, but my view is that these features should be built-in to the IDE, and not left to individual plugin contributors to write.
I’m sure at some point, VS Code will have Java support to rival IntelliJ IDEA. But, until then, I’m sticking with IntelliJ IDEA as my Java IDE recommendation, and VS Code as a solid second place.
What if you can’t install an IDE? Then try an online one. Let’s dive in.
Online Java IDEs
If you want to develop Java programs, but you can’t install a Java Development Kit, you can still code using an online Java IDE.
Online Java IDEs run in your web browser. They aren’t all as feature-rich as their desktop counterparts, but they’re certainly catching up!
It works thanks to a little magic. Your web browser doesn’t natively run Java code, so usually your code gets passed to a back-end server, which runs it and returns the result back to you.
Here’s some of the best options.
A simple online playground for Java (and dozens of other languages).
Riju is a simple online Java compiler.
It loads super-fast, and is great for writing simple, command-line Java programs.
And, it’s open source.
(Riju isn’t exactly a full-blown Java IDE, and you can’t pull in dependencies, but for simple programs, it does the job.)
Riju supports lots of other languages too, such as “Brainf***”. So if you’ve ever wanted to program in that language, check it out!
The project costs money to run, so if you use it a lot, make sure you chuck a tip to the developer. (See the sponsorship links on the GitHub repo.)
Write command-line Java programs in your browser, with some limited support for Maven dependencies.
Replit is a rich tool for writing programs in the REPL style.
You edit your code in an editor like this:
And then press Run to see it compiled and executed.
It’s free on the Starter Plan, but they’d like you to upgrade to a paid plan, which allows private repositories, and access to more storage and resources.
You can have a play with an embedded REPL.it here. I created a Java application with a
main class, which starts Apache Camel:
Pull and run code directly from Git repositories, with 50 hours free per month.
The Gitpod team have built something pretty impressive.
It’s a browser-based IDE which uses the familiar VS Code UI – so you can even install Visual Studio Code extensions if you want them.
It’s pretty good. I pointed it at one of my GitHub repos, and it opened it within seconds, and it automatically set me up with a Java 11 workspace with Maven. Love it.
It all runs online, and you can even expose your application’s web ports. So if your application has a REST API, you can test it directly in your web browser.
On the free plan, you get 50 hours per month – which should be plenty for your weekend coding projects!
Now get coding!
So, there you have it. My recommended IDE for desktop-based Java development is IntelliJ IDEA.
If you prefer a code editor with additional Java support features, then I recommend Visual Studio Code with the Java Extension Pack.
And finally if you want to do some online Java coding, then try Riju, Replit or Gitpod.
Now you’ve seen the recommendations, what are you waiting for?