Here is a guideline to help you get started to write Java code in Visual Studio Code.
The workspace contains two folders by default, where:
src: the folder to maintain sourceslib: the folder to maintain dependencies
.
└───HelloWorld
├───.vscode
├───bin
├───lib
└───srcMeanwhile, the compiled output files will be generated in the bin folder by default.
If you want to customize the folder structure, open
.vscode/settings.jsonand update the related settings there.
We are going to create our source code in src folder.
From your root solution folder (HelloWord), run the below command which will compile source code to bin folder
javac src/App.java -d bin# Switch to bin directory
cd bin
#Run java application .class
java App
# Output
Hello, WorldThe JAVA PROJECTS view allows you to manage your dependencies. More details can be found here.