Project Software Setup

Contents:

Options for where to work

There are five main options for where to do your work. We recommend that you at least complete option 1, Install software on your own computer, so you are able to work on your personal device. You can use multiple options if you choose to, but doing so requires you follow set up steps and clone your repository multiple times.

  1. Install software on your own computer

    Most people will do this. The following instructions in this document detail how to set up for this step. We will complete most of our set up together in our "Software Setup" section, but please complete the Before Attending the CSE 331 "Software Setup" Section... beforehand.

  2. Work in the Gates Center or Allen Center labs

    With this option, there is no software to install and you can proceed directly to learning how to use version control, IntelliJ, etc.

  3. Do your work by logging into attu

    Attu is a (a Linux computer cluster) that you can log into and use remotely. There is no software to install. This combines the convenience of your own computer with the department installation of Linux. You have access to the same account and files as when working in the Gates/Allen Center labs.

    Logging into attu is not a good way to run a graphical application, such as IntelliJ, but it is good option to verify your code is running properly after working locally.

  4. Use the department's home virtual machine on your own computer

    Follow the department's instructions. This puts a copy of the lab's Linux installation on your own computer, even if your computer does not otherwise have Linux. This combines the convenience of your own computer with the department installation of Linux.

    The Linux Home VM has almost the same software as CSE-managed computers. You will need to install IntelliJ IDEA yourself (the license is free for students).

Disclaimer about where you work:

Many students find working directly on their own computer most convenient. You may use whatever tools you like to develop your code. The only thing the staff cares about is that your code works on attu (see option 3).

The CSE 331 staff provides technical support only for using IntelliJ or the command line on UW CSE machines. For other setups, we will try to help to the extent feasible. However, it can be difficult to predict and debug every installation/configuration problem, and we are not familiar with every operating system, text editor, or possible interaction between programs. We will prioritize helping students with homework, grading assignments, etc. over debugging the configuration on your machine.

Most students have a little trouble setting up their environment. If you are a spending a long time debugging a problem with your environment, we strongly suggest that you go to office hours or the ed board for help.

Before Attending the CSE 331 "Software Setup" Section...

Please do the following steps before you arrive at our "Software Setup" section (the second section of the quarter). If you have any trouble, get as far as you can on your own and come to section with what you have.

Determine your operating system

Figure out if you're using a MacOS, Windows, or Linux. Then, select the corresponding view from the options at the top of the document to make sure that you follow the instructions that work for your computer.

Install the Java 11 JDK

On the Eclipse Temurin installers page, select Version 11 from the dropdown, then find the jdk-11.0.14.1+1 option and run the JDK installer for your OS (MacOS or Linux). The installers can be run using default options

  • To verify installation, open a terminal (Terminal application, or if a Linux users, the terminal of choice) and type the following command:

       javac --version   

    A message should be printed indicating version 11 is installed. If you get an older version or have trouble, try uninstalling older versions of Java that may be installed, or contact the course staff for more help.

  • Also, verify that you have an appropriate version of the javadoc tool installed:

       javadoc --version   

    You should get a message indicating javadoc version 11.

Install the IntelliJ IDEA

  1. Sign up for the Ultimate version of IntelliJ

    Through your @cs.washington.edu email you have access to a free student license for the Ultimate version of IntelliJ IDEA. Follow this link and click "Apply Now". If you have to sign up for an account with IntelliJ, use your @cs.washington.edu email.

    The IntelliJ IDEA student license screen.

    After signing up you should get an email from IntelliJ IDEA momentarily; follow any instructions they give you.

    If you already have a free student licesnse for IntelliJ Ultimate from a previous UW CS class, you do not need to complete this step unless your license is expired

    All petitioning students registered for CSE331 should have recieved guest CSE computer accounts for the quarter. If you believe you do not have an account, verify you didn't miss it by checking your email, and then contact the course staff via cse331-staff [at] cs.

  2. Download the IntelliJ IDEA "Ultimate" edition

    Download the IntelliJ IDEA "Ultimate" edition by following this link to the IntelliJ web site. Click the "Download" button appropriate for your OS (macOS or Linux). This may take a little while depending on your computer/laptop and connection.

    The macOS IDEA installation option.
  3. Connect the IntelliJ application to your Ultimate License

    Open IntelliJ once it has finished installing. When it starts up, you will need to "Log in to your JetBrains Account" with the account you created. Then you should get a confirmation that your license is in use. During the "Software Setup" section we will configure IntelliJ, but for now, you don't need to do anything else.

    IntelliJ startup page showing JetBrains log in for macOS.

Install git

If you haven't installed git already, you can find git installers on the git downloads page.

MacOS Users: If you'd like you can install the full Apple developer command line tools package, including git, by running xcode-select --install from the terminal. This includes command line developer tools that you may find useful for future courses. Another option, is installng the Homebrew Package Manager and then using it to install git. Both of these options are detailed on the git downloads page.

Once git is installed, navigate to preferences by selecting "Customize" from the left side options bar, and then "All Settings..." at the bottom of the page (or select IntelliJ » Preferences for mac users). Navigate to » Version Control » Git and click the Test button at the top right. This test should succeed and report a git version below. If you have any trouble with this, contact the course staff for help. See the below screenshot for where the Test button is on the preferences window.

If you get an error when you press the Test button, you may need to specify the path to the git executable which can be found by using the command where git in a terminal.

The IntelliJ git preferences screen.

You should stop here. We will complete the rest of the setup as described below during section as a group.

Cloning the project (creating your working copy)

Cloning your project creates a local repostory (stored in a hidden directory) and a working copy (where you do your programming). This allows you to edit your personal copy of files under git control. You will only need to clone your project to your personal computer once for the term.

Ensure that your repository exists, by browsing to https://gitlab.cs.washington.edu/cse331-QUARTER-students/cse331-QUARTER-YourCSENetID (be sure to change the YourCSENetID and QUARTER parts! (quarter is of the form'22au').

Set up an ssh key

(If you plan to work from multiple computers, do this for each)

  1. Open a Terminal window, and run the following command, replacing "your@email.com" with any identifying text (This is just "comment" text, as indicated by -C. Make sure it is something you'll recognize and do not remove the quotations).

    ssh-keygen -o -t rsa -b 4096 -C "your@email.com"
  2. Press enter when asked for a file name (use the default name)

  3. Do not use a passphrase

  4. You'll receive a message stating that your public key is saved in [some public key file name]. The file is probably called ~/.ssh/id_rsa.pub, but take note of whatever is listed from the command for the next step, it will end with ".pub".

  5. Open the file where the key has been saved by running the following command:

    cat [public key file name here] | pbcopy 
  6. After running the command, the public key you created will be copied automatically; save it for the next step.

Add your ssh key to git lab

Navigate to CSE Gitlab and sign in. Open the profile menu in the top right corner and click "Preferences". Choose "SSH Keys" from the left options bar, then paste your public key copied from the previous step into the text box. The "Title" field can be whatever you want - we recommend writing something that identifies which computer you created the key on (i.e. "Personal Laptop" or "attu."). Finally, click the "Add Key" button.

Git lab ssh key set up settings.

Run the following command to ensure that your key is correctly setup. You should receive a welcome message and should not be prompted for a password. If you receive a message saying "the authenticity of the host could not be established", it's safe to type 'yes' to bypass this message.

    ssh -T git@gitlab.cs.washington.edu    

Clone to IntelliJ

Follow these instructions when working on personal computer or lab machine. If you intend to work on attu, use the Command Line instructions. You need not follow both sets of instructions, only the relevant set.

Open IntelliJ, choose "Get from VCS". Select "Git" under the "Version Control", dropdown and choose a convenient place on your computer for "Directroy" - this is where you'll be storing your 331 work for the rest of the quarter. In the "URL" box, paste the text below with '22au' in the place of "QUARTER" and your CSE NetID in the place of "NETID".

git@gitlab.cs.washington.edu:cse331-QUARTER-students/cse331-QUARTER-NETID.git
Intellij cloning with version control page.

Cloning may take some time, and IntelliJ may have to perform downloads and take some time to build. Wait until the build is complete before proceeding to the next step.

Clone on Command Line (attu cloning)

Use these instructions to clone your repository when you're signed into attu or another computer that only has a command line interface or doesn't have IntelliJ. if you are trying to clone for IntelliJ follow the IntelliJ instructions. You need not follow both sets of instructions, only the relevant set.

Execute the following commands at the command prompt to clone the project and create a working copy in ~/cse331-QUARTER-NETID:

cd
git clone git@gitlab.cs.washington.edu:cse331-QUARTER-students/cse331-QUARTER-NETID.git

Note: for those who are new to the command line: when you try to type passwords in the command line, you won't be able to see any text entered. Your typing isn't shown to protect your password. Just type your password as usual and press enter.

Configuring IntelliJ for 331

There are configurations we'll be using in 331 to make sure IntelliJ works with all the different technologies that we're using in this class. Be sure to go through the description below and and verify that your configuration is correct.

Using Gradle Integration

We need to configure Gradle so "Run", "Debug", and "Test" buttons throughout IntelliJ will do what we intend according to the Gradle build we're using for this class.

With the cse331-QUARTER-NETID project open in IntelliJ and navigate to preferences (these are project specific preferences). Follow Preferences » Build, Execution, Deployment » Build Tools » Gradle . Open the preference window and make sure that all your settings match those highlighted in red in the image below. For settings not highlighted, they'll be specific to your project and you shouldn't worry about changing them from the defaults. Note that the Java version should say 11, and the specific file path or minor version number doesn't matter.

The IntelliJ gradle config window.

Enabling Generics Error-Checking

We expect your code to not have any generics-related problems.

For example, the following code is unacceptable:

List myList = new ArrayList();
myList.add("foo");          

The generic type List of myList should be parametrized, for instance, to String by replacing the first line with List<String> myList = new ArrayList<String>(); Note that List<String> myList = new ArrayList(); is also incorrect.

By default, IntelliJ doesn't show generics problems as errors. To have IntelliJ alert you to these issues, open the general IntelliJ preferences page and navigate to Editor » Inspections. Search for the inspection "Raw use of parameterized class" and enable it with the checkbox. With that inspection selected, disable all the "Ignore..." checkboxes in the right pane to make sure the inspection will check all of your code for any generics parametrization issues.

IntelliJ preferences with correct generics settings selected.

Correctly Converting Tabs/Spaces

It is often considered bad style to have tab characters in code files, because they display differently for different people. We can make pressing the tab key insert a standard number of spaces by navigating to Editor » Code Style » Java and making sure the "Use Tab Character" checkbox is not selected.

IntelliJ preferences with tab character setting unselected.

Extended Javadoc Tags

IntelliJ will warn you about unrecognized the 331 Javadoc tags (@spec.*), which we wil use in class. There are two ways to eliminate the warnings:

  1. Disable the editor's Javadoc inspection (reccomended)

    From the main menu, choose File » Settings for Linux or IntelliJ IDEA » Preferences for macOS. Navigate to Editor » Inspections » Java » Javadoc and uncheck the box next to "Javadoc declaration problems".

  2. Add each of the extended tags as a known tag for IntelliJ.

    Using the keyboard shortcut: place the caret on the extended tag with a warning and press Alt + Enter. Select "Add spec.* to custom tags".

    Using the settings pannel: Open the Javadoc inspections settings by following the instructions in (1). You do not have to uncheck any boxes. Select "Javadoc declaration problems" and navigate to Options » Additional Javadoc Tags and add all of the extended tags.

  3. IntelliJ preferences with unrecognized javadoc detection unselected.

Logging into attu with SSH

attu is the name of an Instructional Workstation (IWS) Linux machine. You will occasionally need to log into this machine.

SSH on Unix (Linux and MacOS)

  1. Open a command prompt (terminal or console) by navigating to Applications -> System Tools -> Terminal or the one built into IntelliJ

  2. Run the following command:

    ssh YourCSENetID@attu.cs.washington.edu

    Enter the same password you use to login to the Linux machines in the Gates/Allen Center software labs. For those new to the command line, the password is not visible when you type it in in order to protect it.

    If you are using the Linux machines in a Gates/Allen Center software lab, he username defaults to the username you are currently logged in with and the target domain defaults to the domain of the machine you are connecting from, so you can alternatively use a shorter version of the command:

    ssh attu

File Transfer: SCP

If you only want to transfer files between your CSE account and your home machine, you can use scp ("secure copy"). For CSE 331, you should rarely, if ever, need to manually transfer files. All your code and other homework materials will be in a Git repository, allowing you to automatically and safely synchronize your work across machines. We provide information about scp as a reference for your general knowledge.

On a Unix machine, you can run scp at the command line. Run man scp for documentation on this command. If you prefer a graphical interface, you can install a file transfer program such as WinSCP. Most of the directions above for establishing a remote connection via ssh also apply to scp.