Lab 1 Setup: Windows

A video walkthrough for this guide is available at http://fa20.datastructur.es/materials/lab/lab1setup/windows_setup_video.html.

## A. Install Java

2. Important: The installer will give you the following four options:

You should click the small red Xs and change it from “Entire feature will be unavailable” to “Will be installed on local hard drive”. When you’ve done this, it should look like the following:

3. Click next until everything is installed.

## B. Install Git

1. Run the installer. Let git be installed in the default location (C:\Program Files\git). You’ll be faced with many options. We have recommendations for the first two, show below:

2. The first choice is selecting which components to install. The one option to pay attention to is Windows Explorer integration. Checking Windows Explorer integration will add new options to the context menu that appears when you right click a file. These two new options (Git Bash and Git GUI) might maybe one day be helpful to you. Personally, though, I’d turn it off.

3. Next we’ll select a default Git Bash text editor. If you have a favorite text editor that’s on the list, select it. Otherwise you can leave it as vim for now.

4. For all of the remaining choices, the defaults are fine.

2. Open a git bash window (using the start menu, if you didn’t add a start menu link, you can go to C:\Program Files\Git\bin). The window that opens is a terminal window that allows you to interact with a bash shell. We’ll learn more about the bash shell in the lab1setup directions. To test that everything is working, try typing javac --version and press enter. If you see a message that says “javac version 14.0.1” (or other version number that is at least 14), then everything is working fine.

3. Now type (or copy and paste) git config --get core.editor. If you picked a text editor other than vim, you should see something like the image below:

If instead nothing is printed, this means your default text editor is vim. If you’ve never used vim before, type git config --global core.editor "nano" and press enter. This will change the default text editor from vim to nano. nano is much much easier to use. Note: If you’re an experienced vim user, you can skip this step.

As an alternative to the git bash terminal, you can use the new Windows terminal app. I personally think it’s smoother, aesthetically nicer, and has some useful additional features like tabs.

It’s a bit annoying to set up, though, so if you don’t want to go to all the trouble below, the git bash terminal will work fine.

1. To install the Windows Terminal, I recommend using the Microsoft Store, which does not require a login or payment. Alternate installation instructions are at https://github.com/microsoft/terminal.

2. When you start up windows terminal, you’ll see something like the picture below:

3. We don’t want to use “PowerShell”, which is based on Windows. Instead, we want to use “bash shell”, which is based on Linux. To set this up, press “ctrl-,” (control and comma) inside the Windows Terminal and you should see a file called “settings.json” open up in a text editor, as shown below:

4. We’re going to add something to this file where the purple arrow appears in the picture above.

Specifically, you should copy and paste EXACTLY the text below,

 {
"guid": "{00000000-0000-0000-ba54-000000000002}",
"closeOnExit" : true,
"commandline" : "\"%PROGRAMFILES%\\git\\usr\\bin\\bash.exe\" -i -l",
"cursorColor" : "#FFFFFF",
"cursorShape" : "bar",
"fontFace" : "Consolas",
"fontSize" : 10,
"historySize" : 9001,
"name" : "Bash",
"padding" : "0, 0, 0, 0",
"snapOnInput" : true,
"startingDirectory" : "%USERPROFILE%"
}


so that settings.json looks like the picture below:

If you get an error like the message above, you did something slightly wrong. If you can’t figure out what you did to break the settings.json file, then you should delete the entire contents of settings.json, press save, close the text editor, then press ctrl-, to reopen settings.json and try all over again from scratch.

(Thanks to Archimedes Trajano for the nicely written directions on Stack Overflow).

5. If you completed step 2 correctly, when you click on the little downward pointing arrow in the Windows Terminal (which creates a new tab), there should be an option called “Bash”. If you click on “Bash”, you should find yourself in a window that looks a lot like the git bash window. As before, use “javac –version” to verify that everything is working correctly.

If you want to change the default font size (I find size 10 too small, but I’m also almost 40 (WTF)), you can edit it inside settings.json.

6. If you press the + sign, you’ll see that it opens a PowerShell window by default. To change the behavior of the “+” sign so that it opens a Bash window instead, you can edit the defaultProfile option in settings.json to be equal to “00000000-0000-0000-ba54-000000000002”, as shown below:

After copying and pasting, settings.json should look like this:

Try clicking the plus sign, and you should see a bash shell window open. At this point, you’re all done! You can now move on with the rest of lab 1.

## D. Note on WSL2 (experimental)

The Summer 2020 update of Windows contains a Linux kernel called WSL2. As of the time of this writing, this update is still not available on many Windows computers, so we will not be officially supporting WSL2 for Fall 2020. If you’re pretty computer savvy, you’re welcome to try it out though! One word of warning: You may need to install javac, java, and git inside WSL2 again. I’m not sure though since I haven’t had a chance to try it out myself.