Making Visual Studio Code your Java IDE

Advertisements

In Java we have great and very complete IDE tools like IntelliJ, Eclipse and NetBeans, all of them are oriented to Java Applications, have support for the main frameworks and tools in the Java World (Maven, Gradle, JPA, Spring Framework, Hibernate) and autocomplete options that simplify the live of any Java Developer.

Visual Studio Code, on the other hand is not oriented to Java development, but it’s flexible enough and provides the ability to add extensions to support any programming language, or framework that you need. Therefore, by installing the correct extensions we have make it our Java IDE for developing out applications.

One advantage is that with Visual Studio Code we can also installed other extensions for other tasks like: Support Java Script, Git, Docker, Database connections, and more. As a result we have a “swiss knife” for multiple purposes and avoid installing too many tools on our local machine.

Let’s see how to do it…

Install VS Code

The first part is to install VS Code on your machine. So, let’s download the installer from the official page. If you already have installed it, good for you!

Install a JDK

This is step is required for any other IDE, we need to have a Java Development Kit (JDK) installed in our environment. The JDK provides all the tools to run and compile the Java Code. I always recommend to install a LTS (Long Term Support) version, at this moment Java 8, Java 11 and Java 17 are the LTS version available.

There are different options of JDK installers, the most common are:

Installing Java Extensions in VS Code

We are ready to make VS Code our Java IDE, it’s time to install some extensions. If we press the extension sections in the side bar, and type Java in the search bar, we might be overwhelmed with the list of options.

Advertisements

Let’s start by installing the “Extension Pack for Java“, it includes a group of other useful extensions by just one click.

With that, we have a more than enough support of Java in Visual Studio Code, however, there are some other extensions that we can add.

Gradle for Java

Gradle and Maven are the more common building tools in the JVM world (including Kotlin, Scala). With the Extension pack for Java we have support to Maven, so let’s add support to Gradle with the extension “Gradle for Java“.

Spring Boot Extension Pack

In the Java World, Spring Framework and Spring Boot is one of the most commonly use frameworks. If we want to have support for Spring Boot, it’s recommended to install the extension “Spring Boot extension Pack” . It includes a collection of other spring extensions.


Other useful extensions

As I mentioned, Visual Studio code is a “swiss knife” and we could find and add extensions for everything. Let’s see some other useful extensions.

  • Payara Tools: Register, Start, Stop a Payara Server (local/remote) for Jakarta (Java EE) projects.
  • Quarkus: Support for Quarkus and Microprofile development.
  • Docker: The Docker extension makes it easy to build, manage, and deploy containerized applications from Visual Studio Code.
  • Java Decompiler: Helps to decompile the code from a .class file. Useful to see the code for classes and libraries we don’t own.
  • Java Code Generators: Simplifies the generation of code for constructors, getters & setters, equals, hashCode, loggers and other methods.

Conclusion

Even though Visual Studio Code is not a Java Oriented IDE as IntelliJ, Eclipse or NetBeans, in a few minutes we can transform it into a complete Java IDE, with the same features as the others. At the same time VS Code is light weight, and support other tools easily.

References

Advertisements

Leave a Reply

Your email address will not be published. Required fields are marked *