Java programming with Visual Studio Code

A lot of you know about Visual Studio Code, a great editor, supports many things with many extensions from Microsoft. We can use Visual Studio Code to build basic Java applications with the Java Extension Pack. In this tutorial, I will show you how to install this Java Extension Pack and use it to program with Java language!

First, open Visual Studio Code, go to Extension tab then searching for the Java Extension Pack, as follows:

Java programming with Visual Studio Code

In fact, Java Extension Pack is a collection of many other extensions, including:

  1. Language Support for Java (TM) by Red Hat: this extension supports us with Code Navigation, Auto Completion, Refactoring and Code Snippets
  2. Debugger for Java: support us debug code.
  3. Java Test Runner: support us to run the unit test using JUnit and TestNG for Java code.
  4. Maven for Java: support Maven.
  5. Java Dependency Viewer: support us to view libraries, dependencies of Java projects.
  6. Visual Studio IntelliCode: support code completion just like when we use IntelliJ IDE.

Now, please click Install to install this extension!

You can see other extensions defined in Java Extension Pack also installed as follows:

Java programming with Visual Studio Code

The result after pressing the Reload Window button will be as follows:

Java programming with Visual Studio Code

Now you can use Visual Studio Code to start programming basic applications with Java language!

But to do that, of course, you need to install Java first. Myself is as follows:

Java programming with Visual Studio Code

OK, now I will create a new Java file using Visual Studio Code as follows:

You will see that the Visual Studio Code supports code completion like any other IDEs like Eclipse or IntelliJ, for example:

Java programming with Visual Studio Code

Or

Java programming with Visual Studio Code

Very nice, aren’t you?

In this editor window, as you can see, we have two Run or Debug buttons. You can click on these buttons to run the application according to your needs. For example, if I click the Run button, the result will be as follows:

Java programming with Visual Studio Code

Or debug, the result will be as follows:

Java programming with Visual Studio Code

Too great, isn’t it? Compact, light!

Let’s learn more!

One thought on “Java programming with Visual Studio Code

Add Comment