Love the light-weight Visual Studio Code in OS X. Have always wanted the ability to write, debug and run standard java (NOT javascript) from VSC in OS X. Found the following
I can tell you for Windows.
Install Java Extension Pack and Code Runner Extension from VS Code Extensions.
Edit your java home location in VS Code settings, "java.home": "C:\Program Files\Java\jdk-9.0.4".
Check if javac is recognized in VS Code internal terminal. If this check fails, try opening VS Code as administrator.
Create a simple Java program in Main.java file as:
public class Main {
public static void main(String[] args) {
System.out.println("Hello world");
}
}Note: Do not add package in your main class.
Right click anywhere on the java file and select run code.
Check the output in the console.
Done, hope this helps.