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 Ed question.
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 14. If your computer already has JDK 14 (or newer), then you can skip this step.
Windows
Install OpenJDK 14 (LTS) with HotSpot through AdoptOpenJDK.
macOS
Install OpenJDK 14 (LTS) with HotSpot through AdoptOpenJDK.
Linux
Grab JDK 14+ (not JRE) from your favorite package manager.
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. Every student in this course gets their personal repository (repo), in which all code and its history are stored.
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. Keeping your repo 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.
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.
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.
Linux
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, but they are very long and randomly generated. 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, Git can 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. Otherwise, here are the steps:
- Open a terminal on Linux or macOS, or Git Bash on Windows (which comes with the Git installation).
- Generate a new SSH key pair:
ssh-keygen -t rsa
- Next, you will be prompted to input a file path for your SSH key pair. Accept the defaults by pressing Enter on your keyboard. You can optionally choose a passphrase, but it is not required (especially if you are using a personal computer).
- If you are prompted that a key already exists, it means you already have a key. You can type
n
-Enter to exit and go to the next section.
- If you are prompted that a key already exists, it means you already have a key. You can type
Add the SSH Key to Your GitLab Account¶
- Copy your public SSH key (from your home directory,
.ssh/id_rsa.pub
). You can view the contents of a file from the terminal:cat ~/.ssh/id_rsa.pub
- Visit the CSE GitLab SSH keys settings page.
- Paste your copied 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 IDE (integrated development environment) that we’ll be using in this course. If you’ve used jGRASP before, IntelliJ is its real-world, production-ready equivalent.
Downloading IntelliJ¶
- 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.
-
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. A plugin that spots style errors and common bugs.
- jGRASP. A data structures visualizer, by the same team that made the IDE.
-
After installing the plugins, you may be asked to restart IntelliJ. Heed its advice.
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.
-
Let’s make sure that you have access to your personal repository.
Visit GitLab, and you’ll be greeted by a repository named after your UWNetID. 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
. -
Then, Tap the blue Clone button and copy the Clone with SSH Git address. It should look like this:
git@gitlab.cs.washington.edu:cse373-20au-students/YOURUWNETID.git
-
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. Click through the remaining steps, and you should see the IntelliJ main editor in no time.
Sanity Check Java Version¶
Sometimes, IntelliJ might accidentally choose the wrong JDK, so it would be good to make sure JDK 14 is actually selected for your project.
Go to File » Project Structure on the top menu bar. You should see a screen like this:
Make sure that your recently installed JDK 14 is selected for Project SDK. If the Project language level shows a language level less than 14, you should manually change it to 14.
Configure Checkstyle¶
In this course, there are no manually graded style points. Instead, you will get full credit on code style as long as you fix all Checkstyle warnings. We’ll need to set up the Checkstyle plugin with CSE 373-specific settings.
- Open the Settings dialog (On macOS IntelliJ IDEA » Preferences, otherwise File » Settings).
- Navigate to Tools » Checkstyle.
- Make sure the Checkstyle version selected is 8.33 or greater.
- Change the Scan Scope dropdown in the top right to Only Java sources (including tests).
-
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.)
-
Back in the Checkstyle settings, mark the checkbox next to “CSE 373 Checks” (or whatever name you chose) to enable it. This would also be a good time to hit Apply.
Configure Generics Checks¶
Finally, we’ll configure IntelliJ to prevent you from making a common generics-related issue. With the Settings window still open:
- Navigate to Editor » Inspections.
- Open the Java » Java language level migration aids » Java 5 section.
- Enable Raw use of parameterized class. If it’s already enabled, click its row to reveal more options.
- Change Severity to Error, and change the other Options below to match this image:
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.