Here's a note about the first steps in getting started with Java programming in VSCode. As of 2020-04, I am trying with the following versions.
--Windows 10 Pro Japanese version --AdoptOpenJDK 11 (HostSpot version)
First, install VSCode.
Then install OpenJDK (Java Development Kit). As of 2020-04, multiple vendors such as Oracle / OpenJDK Official / AdoptOpenJDK / RedHat / Azul / AWS / BellSoft are providing binary packages respectively. I'm sure there are many opinions, but I think it's safe to use the LTS version of AdoptOpenJDK. Download and install 11 (LTS) from the AdoptOpenJDK site.
Install the VS Code extension "Java Extension Pack" provided by Microsoft.
You can find it by searching Java from the extended list of VSCode, and you can install it from there.
Since it is an "Extension Pack", multiple extensions for Java will be installed at once. It will take some time, so be patient with a cup of tea.
After the installation is complete, register the JDK location in VSCode.
In File-> Preferences-> Settings, search for
java.home in the User settings and set the directory for the installed JDK.
(Example) "java.home": "C:\\work\\jdk\\win-x64\\adopt-openjdk-hs-11.0.6_10",
How many JDK folders should I specify? However, it is OK if you specify one above the bin directory. This is recognized as the so-called
Ctrl + Shift + P) and select" Java: Create Java Project ".
src / app / App.javais created by default. If you see an overlay called "Run | Debug" above the main () method, you can start running / debugging from there. You should also be able to run it by right-clicking on App.java and clicking Run / Debug. (I forgot to try)
The Java Extension Pack also includes extensions for Maven. With Maven installed, you can open and work with your existing Maven projects in VSCode.
maven.executable.pathin User settings and set Maven's
bin / mvn.cmd(Win) or
bin / mvn(lin / mac) with full path To do. --Set
maven.terminal.useJavaHometo true. This will use the JDK set in
java.homewhen running Maven. (If you want to set the JDK for Maven execution independently, specify the JAVA_HOME environment variable separately in
Ctrl + Shift + P) and select" Maven: Create Maven Project ".
src / main / (package directory) /App.javaor select" Run | Debug "on main ().
src / test / (package directory) /AppTest.java.
--Open VSCode's Command Palette (
Ctrl + Shift + P) and select" Java: Getting Started "to see the tutorial.
--When you open a Java project, you will also see a Java Overview. There are also various links and leads to operations, so it will be helpful.
--The official VSCode Java guide is also helpful.
――VSCode officially has Java tutorials and explanations of various detailed operations, so if you are working in earnest, this is also helpful.
――If you look at the site of each Extension, you will find detailed settings for studying.
--It's easy to get started with the JDK, so it's recommended for studying and getting started. --VSCode and extensions work lightly, so you don't feel the weight of major IDEs such as Eclipse. ――The first extended startup when you open Java code seems to take some time, but the lightness of VSCode is more stress-free. --Since it is based on Eclipse components, if you look at the configuration file when configuring the Java project, it is the Eclipse project itself. Experience with Eclipse may help you to troubleshoot. ――It may be necessary to investigate a little more how much it can be used for full-scale development. ――How far can VSCode follow the setting hell of Eclipse, especially for source code formats? ――How far can you follow the small undercarriage that can be easily and surely changed on the GUI setting screen with Eclipse, such as switching between multiple JDKs? ――It is recommended if you do not use it as a complicated IDE, but simply use it as an "editor".