Setting up for CSCI 201

Goals:

  • Set up a folder to organize your CS 201 exercises, labs and homeworks.
  • Install VS Code.
  • Install Java and some useful tools.
  • Test your setup by compiling a Java program.

Please follow the steps below to get set up and organized for the work we will do in CS 201. These steps only need to be done once.

Make a cs201 folder

First, please create a cs201 folder wherever is most convenient for you. For example, if you already created a folder for CS 201 on your Desktop to save stuff for this course (notes, handouts, books, etc.), please create another one within that called cs201.

We’ll put all of the work from the semester in this folder, including in-class exercises, labs and homeworks. For example, this might look like:

cs201
├── hw01
│   └── HW1.java
├── lab01
│   └── Lab1.java
├── lecture01
│   └── HelloWorld.java
└── lecture02
    └── ConvertString.java

We recommend avoiding folder or file names that have spaces in them. An alternative is to use a dash - or underscore _.

Install VS Code

We’ll use a popular tool called VS Code to write the text of our programs. Please download VS Code from here:

https://code.visualstudio.com/Download

Use one of the large buttons directly below the operating system icons to download VS Code for your system. Open the installer and then follow the instructions. If you are on a mac, make sure that the application is in your Applications directory.

Turn Off Copilot

Copilot is a tool that is built in to VS Code that will use AI to write code for you. As the learning goals of this class involve developing your ability to write your own Java programs, you should turn Copilot off in VS Code. Here’s what you need to do to turn off copilot once you’ve opened up VS Code:

You’ll see this icon at the top of the window. Click on the symbol to open the menu.

Once you open the menu, you’ll see the option to “Hide AI Features”. Click that button.

Finally, you’ll see a menu asking if you’re sure. Click “Hide AI Features” to continue.

Install git (only for Windows)

We are not actually going to use git in this course, but we will use the “shell” to run some scripts (mostly for testing). If you have a Mac, you already have a shell ready to go. For Windows, the same shell can be installed via Git for Windows. Please click one of the following links to install the appropriate version for your system: 32-bit, 64-bit.

Double-click on the downloaded installer and follow the instructions. This will install Git Bash which we’ll use within VS Code.

Install the Coding Pack for Java

Please visit this page and find the button that says Install the Coding Pack for Java:

Click on the button for your operating system and then, once the download finishes, open it to install the coding pack. This should install the Java Development Kit (JDK) on your system.

Install a few extensions

In the left toolbar of VS Code, you should see a handful of icons, one of which looks like a few blocks (kind of like the Tetris game).

Clicking this will open up the Extensions interface, which will allow you to install a few useful extensions.

Install the Debugger for Java

In the search bar of the Extensions interface, type “Debugger for Java”. Click Install on the first search result:

If it has already been installed, ignore this instruction! The same goes for other extensions.

Install the Live Share extension

In the search bar of the Extensions interface, type “LiveShare”. Click Install on the first search result:

Our first Java program!

Now that we have a cs201 folder and the Coding Pack for Java installed, let’s create our first Java program! First, create a folder within your cs201 folder. You can call this lecture01 if you want, or something else.

Now, open up VS Code and click File -> Open Folder. Then navigate to, and open the lecture01 folder you just created. VS Code should open a new window and you should see the contents of your cs201/lecture01 folder on the left (which will be empty for now).1 Then create a new file using File -> New Text File and copy the contents below into this file.

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

Save the file to your lecture01 folder and call it HelloWorld.java. At the top right of the VS Code editor, you should see a button that looks like a Play button.

Click this! A terminal should open up somewhere in VS Code and the command that was used to compile and run your program will be displayed. You should also see the Hello, World! message.

There are other ways to compile and run your programs, but we’ll talk about that soon.

Footnotes

  1. Click “Allow” in any menus that appear. I suggest selecting “Trust the authors of all files in the parent folder ‘cs201’” so that you don’t have to do this every time you create a new folder.↩︎