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:
In fact, Java Extension Pack is a collection of many other extensions, including:
- Language Support for Java (TM) by Red Hat: this extension supports us with Code Navigation, Auto Completion, Refactoring and Code Snippets
- Debugger for Java: support us debug code.
- Java Test Runner: support us to run the unit test using JUnit and TestNG for Java code.
- Maven for Java: support Maven.
- Java Dependency Viewer: support us to view libraries, dependencies of Java projects.
- 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:
The result after pressing the Reload Window button will be as follows:
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:
OK, now I will create a new Java file using Visual Studio Code as follows:
1 2 3 4 5 6 |
public class Hello { public static void main(String[] args) { System.out.println("Hello"); } } |
You will see that the Visual Studio Code supports code completion like any other IDEs like Eclipse or IntelliJ, for example:
Or
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:
Or debug, the result will be as follows:
Too great, isn’t it? Compact, light!
Let’s learn more!
codeName
huong dan k chi tiet