Recently, I started on a new team and project that was in Java. Our initial thought was to switch back over to Spring Tool Suite or IntelliJ. But, there are some really good extensions now for Java in VS Code that made that transition unnecessary. So we decided to take a look at what Visual Studio code could do for us – we were very pleasantly surprised!
In this post, I provide links and information to get you started down the right path for Java in Visual Studio Code.
Visual Studio Code
The first place to go to get started is the Visual Studio Code – Java page located at https://code.visualstudio.com/docs/languages/java. If you don’t already have VS Code, there is a download link and installation instructions available here.
Next, you will want to check out the Java Extension Pack, which includes:
- Language Support for Java(TM) by Red Hat – Provides Java language support via Eclipse JDT Language Server, which utilizes Eclipse JDT, M2Eclipse, and Buildship.
- Debugger for Java – A lightweight Java Debugger based on Java Debug Server which extends the Language Support for Java by Red Hat. It allows users to debug Java code using Visual Studio Code.
- Java Test Runner – A lightweight extension to run and debug Java test cases in Visual Studio Code. The extension supports JUnit 4 (v4.8.0+) and JUnit 5 (v5.1.0+).
- Maven for Java – Maven extension for VS Code. It provides a project explorer and shortcuts to execute Maven commands, improving the user experience for Java developers who use Maven.
To help get things up and running on the Server side, some great extensions are:
- Spring Boot Support – VS Code extension and Language Server providing support for working with Spring Boot application.properties, application.yml and .java files.
- Spring Initializr Java Support – Spring Initializr is a lightweight extension to quickly generate a Spring Boot project in Visual Studio Code (VS Code). It helps you to customize your projects with configurations and manage Spring Boot dependencies.
- Tomcat – Debug or run your java war package in Apache Tomcat.
To search for more extensions, switch to the Extensions view (Ctrl+Shift+X) and filter on Java.
You can learn more of the basics about Java in VS Code at:
- Java Tutorial with VS Code – This tutorial shows you how to create a simple Java web application with Visual Studio Code. You’ll learn how to run, debug, and edit the Java web application locally.
- Spring Boot with VS Code – An ideal lightweight development environment for Spring Boot application developers.
- Java Debugging and Testing – A lightweight Java debugger based on Java Debug Server which extends the Language Support for Java by Red Hat.
Some more advanced features to look at are:
- Deploy Java Web Apps to the Azure in the cloud
- Java with Docker
- Java with Kubernetes
- Azure Functions in Java
This will hopefully serve as a good quick reference to get started with what is available for Java in Visual Studio Code.
Feel free to share your thoughts, what issues you run into, any tips and tricks, or how your experience goes on your current or next Java project.