VScode with Java | CS 2113 Software Engineering - Spring 2023

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

Updating your Git environment

Since you are no longer using the ubuntu-vlab01 server, your git environment will need to potentially be reinstalled.

Windows

If you are working on Windows, we recommend that you set-up and use WSL, which you can find resources to do so in this article. If you set-up WSL, then you can follow the steps below for Ubuntu. Otherwise, please refer to this section

Mac

Git should already be installed on Mac. If not, it can be installed on Mac through a package manager like Homebrew with brew install git. However, to do this, you will need to install Homebrew, and you can find instructions here. Alternatives can be found here.

Linux

For Linux and other variations, you can install from the command line with the included package managers. Instructions for the various package managers can be found here.

Other things to remember

There are a few other things that you need to remember to do before your environment is comparable to what you had prior.