Link

System Setup

Installing Git, generating SSH keys, and configuring IntelliJ.

Table of contents

  1. Java
    1. Windows/macOS
    2. Linux/BSD
  2. Git
    1. macOS
    2. Windows
    3. Linux/BSD
  3. SSH Keys
    1. Generate a New SSH Key Pair
    2. Add the SSH Key to Your GitLab Account
  4. IntelliJ
    1. Get Your Repository
    2. Configure Gradle
    3. Configure Checkstyle
    4. Configure Generics Checks

There’s a lot to set up, and it can be frustrating if things aren’t working. Setup can be a bit finicky because different computers behave in different ways. This setup procedure is fairly tedious, but luckily we only need to do it once and it’ll save us time for future project assignments.

If something doesn’t look right, come to office hours and we can work together to figure it out. You can also let us know about any problems by making a new Piazza question.

Tip
The more relevant details we can get about the problem, the better. Include the setup step that’s causing trouble, a summary of the problem, as well as what you expected to see. A screenshot can also be helpful.

Java

All of the project assignments in this course will use Java JDK 11. If your computer already has JDK 11 (or newer), then you can skip this step.

Windows/macOS

Install OpenJDK 11 (LTS) with HotSpot through AdoptOpenJDK.

Linux/BSD

Grab JDK 11+ (not JRE) from your favorite package manager / ports tree.

AdoptOpenJDK also has pre-built .deb and .rpm files, if you can’t get it as a package.

Git

Git is a version control system (VCS): a tool for tracking changes between versions of code and sharing those changes with other people. A VCS allows us to not only see changes from old code, but also revert back to older versions and manage many different team members contributing to a project at the same time. All of this information about our code and its history is stored together in one unit called a repository (repo). It’s a data structure that represents all of our work.

You may have heard of GitHub before. GitHub is an online platform for storing and managing backups of our Git repositories.

In this course, we will be using CSE GitLab, a CSE-supported alternative to GitHub. While your Git repository works locally, keeping it backed up on CSE GitLab not only makes it convenient to find past versions of your work in case your computer crashes, but it also simplifies the process for turning in projects and allows you to collaborate with others.

macOS

macOS generally comes with Git included, but sometimes there might be an extra download step.

From Finder, navigate to Application » Utilities » Terminal. Type git into the terminal and hit Enter. If you get a download prompt, follow the prompt. Otherwise, you will see a help message if git is successfully installed.

Windows

Windows users must download and install Git manually. You can grab the latest version from Git’s official Windows release download page and follow the installation wizard afterwards.

All of the default settings are acceptable for this course. You can choose different settings if you have a particular preference. If you do intend to change any preferences, make sure to leave Configuring the line ending conversions to the default option, Checkout Windows-style, commit Unix-style line endings, to ensure compatibility with our Linux-based (Unix-style) autograders.

Linux/BSD

Users of Unix-like operating systems can generally install git from their package manager (the package is usually just named git).

SSH Keys

You will need to generate SSH keys to use the CSE GitLab. SSH keys fill the same role as a username and password: we use them to authenticate our digital identity with a service. SSH keys can be thought of as very long, randomly generated, unique identifiers that serve as both your username and your password. Many programming tools prefer to use SSH keys because they are extremely difficult to be guessed or broken.

Since SSH keys are very long, we don’t actually type in SSH keys with a keyboard. Instead, your computer will store your SSH key and automatically send it to a service when you need to authenticate. When all setup, authenticating with SSH keys are usually faster than using a username and password because you don’t need to enter the details every time.

Generate a New SSH Key Pair

If you already have an SSH key pair, you can use that if you prefer.

  1. Open a terminal on *nix or macOS, or Git Bash on Windows (which comes with the Git installation).
  2. Generate a new ED25519 SSH key pair:
ssh-keygen -t ed25519
  1. Next, you will be prompted to input a file path for your SSH key pair. Accept the defaults by pressing Enter on your keyboard.
  2. Once the path is decided, you will be prompted to input a password to secure your new SSH key pair. It’s a best practice to use a password, but it’s not required and you can skip creating it by pressing Enter twice.

Add the SSH Key to Your GitLab Account

  1. Copy your public SSH key (from your home directory, .ssh/id_ed25519.pub). You can view the contents of a file from the terminal:
    cat ~/.ssh/id_ed25519.pub
    
  2. Visit your CSE GitLab account at gitlab.cs.washington.edu.
  3. Navigate to the SSH Keys by tapping on your avatar in the upper right corner and selecting Settings. Paste your public key into the Key field. Give it a title if it doesn’t have one already. Then, tap Add key.

IntelliJ

IntelliJ is the integrated development environment (IDE) that we’ll be using in this course. If you’ve used jGRASP before, IntelliJ is its real-world, production-ready equivalent.

Download and install IntelliJ Community Edition. Open IntelliJ after installation is finished. During the first startup, IntelliJ will ask you to configure some editor settings. You can Skip Remaining and Set Defaults, or choose a color scheme and continue.

IntelliJ Welcome

After the initial setup steps are complete, you’ll be greeted by the welcome window. In the “Welcome to IntelliJ IDEA” window, tap the Configure dropdown in the bottom right corner and choose the Plugins menu item. From the “Plugins” window, we’ll install two plugins: Checkstyle-IDEA and Java Visualizer. After installing the plugins, restart IntelliJ.

IntelliJ Plugin Search

Get Your Repository

Now that the initial IntelliJ setup is done, we can download a copy of the code by cloning your personal CSE GitLab repository.

First, let’s make sure that you have access to your personal repository. Visit GitLab, and you’ll be greeted by two repositories: skeleton, and a repository named after your UW NetID. This named repository is your personal repository. Your personal repository should already have some files and folders inside including the skeleton code for the first project assignment, cse143review.

Tap the blue Clone button and copy the Clone with SSH Git address. This should look like the following address except named after your UW NetID.

git@gitlab.cs.washington.edu:cse373-20sp-students/YOUR_UW_NETID.git

GitLab Clone

In the IntelliJ welcome window, tap on the Get from Version Control. Paste the Git address from earlier and choose a directory to store your personal repository. Once IntelliJ finishes cloning your repository, a new window will ask if you want to create or import a new project from this repository. Tap Yes to accept. You should see the IntelliJ main editor shortly.

Configure Gradle

Gradle is a neat Java build system that downloads dependencies and configures your environment for you. In CSE 373, we will a maintain configuration file for you. We want to configure Gradle to always use our newest configuration files as projects gradually get released.

  1. Open the Settings dialog (IntelliJ IDEA » Preferences on macOS, File » Settings everywhere else).
  2. Navigate to Build, Execution, Deployment » Build Tools » Gradle.
  3. Check the checkbox that reads Automatically import this project on changes in build script files.

IntelliJ Gradle Config Screen

Configure Checkstyle

We’ll need to set up the Checkstyle plugin with CSE 373-specific settings.

Still in the configuration window, tap on the Checkstyle item at the bottom of the sidebar. From here, we have a few things to do.

  1. Make sure the Checkstyle version selected is 8.24 or greater.
  2. Change the Scan Scope dropdown in the top right to Only Java sources (including tests).
  3. Add the CSE 373 checkstyle configuration. Tap the + icon on the right side under Configuration File section. In the window that appears, enter a description like “CSE 373 Checks”. Then, make sure select Use a local Checkstyle file is selected and paste in the following path:

    config/checkstyle/checkstyle.xml
    

    (Enable Store relative to project location if you plan to ever move or rename the project directory; otherwise, it doesn’t matter whether this is enabled or not.)

  4. Back in the Checkstyle settings, mark the checkbox next to “CSE 373 Checks” (or whatever name you chose) to enable it.

IntelliJ Checkstyle

Configure Generics Checks

Finally, we’ll configure IntelliJ to prevent you from making a common generics-related issue. With the Settings window still open:

  1. Navigate to Editor » Inspections.
  2. Open the Java » Java language level migration aids » Java 5 section.
  3. Enable Raw use of parameterized class. If it’s already enabled, click its row to reveal more options.
  4. Change Severity to Error, and change the other Options below to match this image:

IntelliJ generics

Now, you can click OK to save and apply the settings.


Phew, that’s it! What’s next?

Follow the Using IntelliJ quick start guide to introduce yourself to the software we’ve just installed.