There are five main options for where to do your work. We recommend that you at least complete option 5, install the software on your own computer, so you are able to work on your personal device. You can use multiple options if you choose to! Doing so generally requires you to make multiple clones of your repository.
attu
(a Linux
computer cluster) and using it remotely. Again, 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 in to attu is not a
good
way to run a graphical application such as IntelliJ.
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 using your own tools:
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.
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 own machine.
Most students have little trouble setting up their environment. If you spend 2 or more hours trying to debug a problem with your environment, we strongly suggest that you go to office hours or the ed board for help or stop and use of the other options for getting your work done.
Please do the following steps before you watch the software setup recording, we will not cover this portion. If you have any trouble, just get as far as you can on your own and then come to OH with what you have.
Figure out whether you are using a MacOS, Windows, or Linux. Make sure that you follow the instructions for your operating system. This is important because depending on your system, you may have to uninstall some outdated software to complete this process.
Install the Java 11 JDK. On the Eclipse Temurin installers page select the OpenJDK 11 option, the jdk-11.0.14.1+1 option and run the JDK installer for your particular operating system (as determined in the previous step).
MacOS and Linux users can just run the installers directly using the default options. Windows users should run the installers and additionally make sure "JavaSoft (Oracle) registry keys" and "Set JAVA_HOME variable" are checked when prompted. We generally suggest that Windows users uninstall all previous versions of Java (JDK or JRE) before installing the current version to reduce the chances that IntelliJ or other tools will pick up the wrong version by accident.
To verify your installation, open a terminal (MacOS users open the Terminal application, Windows users can open Git Bash or Command Prompt, and Linux users open your 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 you may have 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
Sign up for your free student license for the Ultimate version of IntelliJ IDEA using this link. Click on the "Apply Now" button (see below). Make sure that you sign up with your @cs.washington.edu email. You should get an email message momentarily from IntelliJ IDEA once you've done this. Follow any instructions that they give you. You may have to sign up for an account with them, if you do, use your @cs.washington.edu email Please note that if you already have a free student license for the Ultimate version of IntelliJ IDEA from a previous UW CS class, you do not need to complete this step unless your license has expired. Also, all students registered for CSE 331 should have received guest CSE computer accounts for the quarter. If you do not have an account for some reason, check your email to see if you missed it, and if you still can't find it, contact the course staff via email.
Get the IntelliJ IDEA "Ultimate" edition using this link on the IntelliJ web site. See below for the downloading options you should choose based on your operating system type (just click "Download" and you'll be good to go). This may take a little while depending on your computer/laptop and connection.
Once IntelliJ has finished installing, select the app icon and open it. When IntelliJ starts up, you will need to input the same email/id that you used to register for your free student license that you obtained previously in Step 3, above, to enable all the features of the IntelliJ ultimate edition. Then you should see a welcome page where your project for 331 will be after future steps.
You will need to configure IntelliJ once you get it running, as described later in this handout, but that can wait until watching the "software setup" CSE 331 recording.
Install git if you don't already have it. Follow the standard instructions for installing it on your operating system. You can find git installers at the git homepage.
xcode-select --install
from the terminal.
This includes many additional tools that some people will find useful for other courses
(like c/c++ compilers and debuggers.) Note: This does not install the full XCode IDE,
just the command line developer tools.
The tools are also installed automatically if you have installed the Homebrew package
manager
(https://brew.sh/; also not required for CSE 331, but popular
with many MacOS developers).
Once you have git installed, navigate to IntelliJ preferences from the homepage: select "Customize" from the left side options bar, and then find "All Settings..." at the bottom of the page (Mac users can also select IntelliJ » Preferences). From there 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.
You should pause here. We have a complete walkthrough of the rest of the setup as described below on Canvas.
You always edit your own personal copy of files that are under git control. Before you can make such edits, you must “clone” to create your local repository (which is stored in a hidden directory) and your working copy (where you will do your programming). You need to do this step only once at the beginning of the term. If you plan to work at both UW CSE and home, you need to do these setup steps both while logged into a department machine and from your home computer, so you have a local copy on both machines.
ssh-keygen -o -t rsa -b 4096 -C "your@email.com"
cat [public key file name here] | clip # Windows cat [public key file name here] # (macOS/linux)
ssh -T git@gitlab.cs.washington.edu
NOTE: Occasionally, Windows users have had trouble cloning their repository within IntelliJ. These Windows users had success cloning their repository from the command line using the "git bash" tool, then doing all their work within IntelliJ after the initial clone step. Please try that if you have trouble.
First, set up an ssh key by following the instructions above.
git@gitlab.cs.washington.edu:cse331-QUARTER-students/cse331-QUARTER-NETID.git
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. 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.
You can run any git command in any directory of your working copy.
There are some configurations that we'll be using in 331 to make sure IntelliJ works with all the different technologies that we're making use of in this class. Be sure to go through the description below and and verify that your configuration is correct.
In order to make full use of IntelliJ, we have to make sure that it is configured correctly to utilize the Gradle build that we're using for this class. By making sure this is configured correctly, IntelliJ will know that when you click the "Run", "Debug", and "Test" buttons throughout IntelliJ, it'll instruct Gradle to do those actions, which means all of our configurations will work properly.
Open the cse331-QUARTER-NETID project in IntelliJ and navigate to preferences (these are project specific preferences rather than general IntelliJ preferences). Follow Preferences » Build, Execution, Deployment » Build Tools » Gradle. Open the preference window and make sure that all of your settings match the settings highlighted in red in the image below. For settings not highlighted in red, 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 version 11, and the specific file path or minor version number doesn't matter - just the major version number.
Now that the above settings are correctly configured, IntelliJ should always use gradle correctly and you'll be able to use all the built-in tools provided by IntelliJ to help you write better code.
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. We want to tweak a setting to tell IntelliJ to help make sure you're following generics best practices and don't forget any type parameters. To do so, 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.
You may need to specify the path to the git
executable: In the Settings/Preferences
dialog (Ctrl+Alt+S), select Version Control »
Git in the left pane. This is only needed if you get an error when you press "Test" in this
preference pane.
It is often considered bad style to have tab characters in code files, because they display differently for different people. (Pressing the Tab key while using your editor is great, but that key should should insert spaces.) In IntelliJ IDEA, make sure that the Editor » Code Style » Java : Use tab character checkbox is not selected.
IntelliJ will warn you about unrecognized the 331 Javadoc tags (@spec.*
). There are two
ways to eliminate the warnings.
Alt + Enter
.
After you have done one of the above, the warnings for the extended tags will go away.
attu
is the name of an Instructional Workstation (IWS) Linux machine. You will
occasionally need to log into this machine. How you log into attu depends on whether you are starting
from a Unix machine or a Windows machine.
ssh YourCSENetID@attu.cs.washington.edu
Use the same password you use to login to the Linux machines in the Gates/Allen Center software labs.
Note for those who are new to the command line: When you try to type passwords in the command line, you may be alarmed that you can't see any text entered. To protect your password your typing simply isn't being shown. Just type your password as normal and press enter.
If you are using the Linux machines in a Gates/Allen Center software lab, you can alternatively use a shorter version of the command:
ssh attu
This works because the 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.
attu.cs.washington.edu
by entering it in the Host
Name
textbox and clicking Open
. You will be prompted for your username
and password.
In either case, your username is your CSENetID, and your password is the same one you use to login to the Linux machines in the Gates/Allen Center software labs.
The first time you connecting to attu
from a given machine, you will receive a server
authenticity warning like this:
The authenticity of host 'attu.cs.washington.edu (128.208.1.139)' can't be established.
Along with the warning, the SSH client will display the RSA key fingerprint of the remote host so that you can verify the host's identity if you wish. It is safe to say "yes" to continue connecting. When you connect, SSH will cache the host key in order to automatically verify the remote host's identity in the future.
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 (Linux or MacOS) machine, you can run scp at the command line. Run man scp
for
documentation on this command. If you prefer a graphical interface or if you are using Windows, 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.