Setting up for CSCI 201

Goals:

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.

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:

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 called lecture01 within your cs201 folder. You can call this lecture1 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). 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.