VScode with Java | CS 2113 Software Engineering - Fall 2021

Running VSCode with Java

Note that for using Java we DO NOT USE a docker environment. You will run all your programs locally on your machine.

  1. Determine which version of the Java Developers Kit (JDK) is currently installed on your machine. Open a terminal/powershell/command-prompt (not in VScode) and check your Java version

    java -version
    
  2. If your version of Java is less than 11. Install the latest version of Java. (The latest version is 17, but you only need at least version 11)

    Oracal also provides a handy installation guide, if you run into issues.

  3. Install the Extension Pack for Java plugin for VS Code
    Visual Studio Image

  4. In VSCode create a new folder, or open an existing folder.

  5. Create a new file called Hello.java and populate the file with the hello world code.
    /*Hello.java*/
    public class Hello {
     public static void main(String args[]){
         System.out.println("hello, world");
     }
    }
    
  6. Open a new terminal in vscode.

  7. In the terminal window use javac to compile Hello.java, then use java to run Hello.
    VS Code javac Image