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
└───src
Meanwhile, the compiled output files will be generated in the bin
folder by default.
If you want to customize the folder structure, open
.vscode/settings.json
and 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, World
The JAVA PROJECTS
view allows you to manage your dependencies. More details can be found here.