Late last year, Oracle announced a new extension for Visual Studio Code for Java developers. This extension is called Java Platform Support, and according to Oracle's announcement, the main reason for creating this extension was the increasing popularity of Visual Studio Code as a universal general-purpose IDE, especially among students learning Java and people who use other languages alongside Java.

In this article, we want to take a look at this VS Code extension and see if it is a step in the right direction for the future of Java development in VS Code or not and compare it with two other popular extension packs for Java development in VS Code ( Microsoft Extension Pack for Java and Spring Boot Extension Pack)

None
Java development alternative extensions in VS Code

· Why Oracle chose to build a Java extension for Visual StudioMy Experience with VS Code for Java development · What does Oracle Java Platform Extension for Visual Studio Code bring us?New Language server based on NetbeansMemory usage and performance comparisonOpen or Create a new Java projectCode completionRun and debugTesting viewOther Features · Final thought

Why Oracle chose to build a Java extension for Visual Studio

Traditionally, NetBeans was the official IDE support by Oracle for Java development, But by increasing the popularity of IntelliJ, especially after the release of IntelliJ IDEA Community Edition as a free and open-source IDE for Java development. NetBeans went by the wayside and got weaker and weaker until Oracle decided to donate the entire NetBeans project to the Apache Foundation.

On the other hand, by increasing the popularity of VS Code, the Java community started to create new extensions for VS Code. Red Hat wrapped the Eclipse JDT Core as a language server for Java for VS Code, and Microsoft and Spring team bundled some more extensions on top of it. In this way, At least Java developers have something to use for Java development in VS Code other than IntelliJ.

By knowing this backstory, I believe that similar to Red Hat, which tried to revamp the core parts of the Eclipse IDE and reintroduce it as a VS Code language server for Java, Oracle is also trying the same with NetBeans language server, and in this way, they try to keep themselves in competition with IntelliJ and develop their extensions on top of the popularity and VS Code's features, such as:

  • Support for multiple languages
  • Ability to run in the browser
  • Fast and lightweight
  • Very powerful remote development capability
  • and…
None
Oracle Java Extension for VS Code

My Experience with VS Code for Java development

For me, without any doubt, IntelliJ IDEA Community Edition is by far the best option for Java development. It is fast, reliable, free, rich (features), and more.

Among all the features of VS Code, two main features are attractive to me, and I feel their lack in IntelliJ are first, the VS Code remote development feature and the other its support for other programming languages than Java for free (Go and JavaScript are more important to me). So, I always try to test real projects using VS Code extensions and try to compare them with IntelliJ. So far, I have not found any VS Code Java extensions that can perform the same as IntelliJ.

What does Oracle Java Platform Extension for Visual Studio Code bring us?

In the rest of this article, I want to get deep into Oracle Java Platform Extension for Visual Studio Code features and compare it with the Microsoft Extension Pack for Java, which is based on the Red Hat Java Language Server for VsCode. During the comparison, I will open the PolarBookShop cloud-native application from this book:

You can access the complete project from this GitHub repository and then open the PolarBookshop folder. This cloud-native app comprises eight different microservices implemented by Spring Boot.

New Language server based on Netbeans

I started programming in Java using NetBeans 4.5 as the IDE and loved it. For years, I stayed on Netbeans IDE except for a short time when I had to use Eclipse for some specific projects. I resisted switching to IntelliJ, but finally, I said goodbye to NetBeans forever and migrated to the IntelliJ IDEA Community Edition.

For me, the main reason to consider this new VS Code extension, at least for review, is this new language server based on Netbeans. Before this, The Red Hat language server, which is based on the Eclipse JDT Core, was the only option, but from now on, we have another alternative. Oracle Java Platform Extension for Visual Studio Code uses a slimmed-down version of the NetBeans language server. Before starting to compare these two language servers in practice, it is worth mentioning that the main benefit of this language server is:

NetBeans language server for VS Code is based on the OpenJDK JDK's javac compiler for code editing and compilation and on OpenJDK's debugger interface for debugging. This will allow support for new JDK features as soon as they are introduced in VS Code, even during Early Access to the JDK.

The first limitation of the NetBeans language server is to support projects based on Java 11 or newer. But the Red Hat language server supports Java 1.5 or newer!

One benefit of the NetBenas language server is that it works individually, and we can open and run Java projects by only installing the language server, but in order to use the Red Hat language server practically, we need to install the Microsoft Java language pack.

Memory usage and performance comparison

Let's open the PolarBookshop project using these two extensions and check the memory usage and also indexing performance.

Oracle Java Extension ⛔️:

  • Indexing time: ~70 sec
  • Memory usage: ~2.2 GB

Microsoft Java Extension Pack :

  • Indexing time: ~40 sec
  • Memory usage: ~1.5 GB

When we use the Eclipse ™ JDT Language Server (Microsoft extension), after opening each file, the language server indexes that file, and it seems that some part indexing happens incrementally, but the NetBeans Language Server opens and index project at once, so the indexing time and memory usage of the RedHat language server is a bit better.

Open or Create a new Java project

Both extensions support Java projects based on Maven and Gradle out of the box. As I mentioned, the Microsoft extension pack's indexing project is faster.

In general, I found the Microsoft Java extension pack more mature for example, the Oracle Java extension has this simple problem with Gralde projects:

One interesting feature of the Oracle Java extension is the Project Explorer panel, This panel reminds me of the NetBeans Project Explorer panel. You can see each project in the root folder as a separate node in this panel. It provides an overview of the logical project structure, making the project exploration easy. You can utilize it to build, test, and execute your Java projects.

None
Oracle Java Extension Project Explorer Panel

Compared to the Microsoft Java Extension pack Project Explorer panel, I found the Oracle one much better, more handy, and cleaner.

None
Microsoft Java Extension Project Explorer Panel

As a side note for the Spring Boot project, I love the Spring Boot Extension Pack project view and dashboard more than these two. It provides much handy and informative information about the Spring Boot project and helps you easily manage it.

Code completion

In code completion, both extensions are on par, but one minor thing that I noticed was that Oracle Java Extension code completion is a bit slower than Microsoft Java Extension Pack, and also, the Microsft extension shows code completion dialogue a bit readable (at least for me):

None
Code Completion in Microsoft Java Extension
None
Code Completion in Oracle Java Extension

One advantage in code completion in the Microsoft Java Extension pack is the Visual Studio IntelliCode extension, which provides AI-assisted development features with insights based on understanding your code context combined with machine learning.

Both extensions have the Source actions feature, which is helpful for code generation.

Run and debug

These features in both extensions are almost the same. One advantage of the Oracle Java Extension is that it provides a Run Configuration Panel, which is interesting and allows us to set program arguments, VM options, environment variables, and Working Directory for projects. By using this panel, we don't need to set the launch.json file manually except for some advanced usages.

None
Oracle Java Extension Run Configurations Panel

Oracle Java extension pack supports Native Image Debugger, which allows Java-style debugging of Ahead of Time compiled native images produced by GraalVM.

Another advantage of the Oracle Java Extension is that it supports run main with continuous mode for gradle projects.

Testing view

In this feature, the Microsoft Java Extension Pack is by far better. The Oracle Java Extension does not have a test panel out of the box, but the Microsoft Java extension has it and also shows each project separately. In addition to that, there is a dedicated view when we run tests for a project.

None
Microsoft Java Extension Testing View

Other Features

Some other useful features like refactoring or Java Doc generation and editing in both extensions are on par, and it does not create a special advantage for any of them.

Final thought

Competition can always be good for us as consumers, but my initial impression of the Oracle Java Extension was not fantastic, I found it a basic product that could be able to compete with Microsoft Java Extension in the future.

Of course, there are some unique features like:

  • Native Image Debugger
  • Run Configuration Panel
  • Run Configuration Panel

But there is a lot of room for improvement. Let me know about your experience with VS Code for Java development as a comment.

You can follow me for upcoming stories:

Read my short technical posts on Twitter.