Definition
Welcome to CMSI 2120! This page has setup instructions for the various technologies that we will need for the course.
Toolkit
Setup of the following is recommended by lecture L1-1 at the latest, and is mandated by lecture L1-2.
Remark
Following along in our first class? Use Day One Setup instead — it is the same material as a short checklist with checkpoints, and it links back here for the detail. This page is the fuller reference to read at home and return to later.
Remark
We will complete tutorials with how to use each of the following in-class and through assignments, but having them downloaded in advance will make the most out of your time in class.
Essentials
Two things are required for this course: IntelliJ IDEA and Git & GitHub.
IntelliJ IDEA
Definition
An Integrated Development Environment (IDE) is a program that bundles many helpers for software development, including: language-specific text editors, compiler warnings, code suggestions, debuggers, unit-test integration, and much more!
For this course, we will use IntelliJ IDEA, JetBrains’ Java IDE. It is what I will use for every in-class demonstration, and it is where essentially all of your work this semester will happen — so this one is required.
-
Download the Community Edition — free, and everything this course needs — from the IntelliJ IDEA download page.
-
As a student you may also claim a free Ultimate license through the JetBrains Education program using your LMU email. Either edition is fine for this class.
-
IntelliJ can fetch Java for you, so no separate Java install is required. When you create your first project (or from
File > Project Structure > Project), open the JDK dropdown and chooseDownload JDK..., then:- Version: the latest LTS release offered.
- Vendor: Eclipse Temurin — the same free, no-account-required JDK we would install by hand, just managed by the IDE.
- Click Download, and IntelliJ takes care of the rest.
Remark
Temurin is the Adoptium project’s free OpenJDK build. Grabbing it through IntelliJ installs it to a JetBrains-managed folder rather than your system PATH, which is all this course needs — see the optional section below if you also want javac at the terminal.
Environment
- Highly tailored to Java development (e.g., class and package detailing, refactoring, inspections).
- Excellent code navigation, and a debugger we will lean on heavily later in the course.
Features
- JUnit support is built in — no plugin hunting or manual configuration required.
- Some learning curve, though the defaults do a great deal of the work for you.
- Opinionated about project structure, which becomes a feature once you are used to it.
Debug
Warning: IDEs can be intimidating at the start, but you’ll grow to love them as you gain comfort — they’re used all the time in industry, so it’s good to get some experience with one now!
Remark
Do not worry about mastering the IDE in advance of the class — we will walk through it together, and the concepts translate to other development environments as well.
Git & GitHub
-
If you haven’t already, sign up for GitHub here
-
Debug
Note that Git has deprecated password authentication and requires you to authenticate using either ssh keys or auth tokens!
Even if you used GitHub in the past, you will need to configure a new authentication method such as here.
-
Download the
gitterminal tools here.Debug
If you are using a Windows computer, make sure to install Git Bash as part of the installation process in the above — you’ll use this instead of the basic command line for your terminal, as it just tends to work better for our objectives.
-
Open a new terminal/git bash window and type
gitand enter — if you see a bunch of options pop up, you’re good to go!
IntelliJ IDEA Guides
Definition
Setup Tutorial: the following walks you through installing IntelliJ IDEA, creating your first Java project, and running it.
Assignment
Definition
JUnit + Debugger Tutorial: take a look at how to run tests from the editor, and how IntelliJ’s debugger plays nicely with JUnit!
Assignment
Remark
These are JetBrains’ official guides rather than course recordings, which means they stay current with each IntelliJ release. We will still walk through all of this together in class.
IntelliJ + JUnit
Definition
This section of the tutorial applies to those using
IntelliJ IDEAas their primary development environment.
Toolkit
In order to run JUnit tests in IntelliJ, it is fairly simple, but requires one extra step to ensure that the JUnit library is on the project’s classpath.
Our assignment skeletons ship with a junit.jar, so the simplest route is to point the project at it:
- Open the project, then go to
File > Project Structure...(Ctrl + Alt + Shift + S, or⌘ + ;on a Mac). - Select Modules in the left panel, then the Dependencies tab.
- Click the
+button on the right and choose JARs or Directories… - Select the
junit.jarincluded in your assignment skeleton, leave the scope asCompile, then Apply and OK.
Toolkit
IntelliJ can often do this for you: put your cursor on a red
@Testannotation ororg.junitimport, pressAlt + Enter(⌥ + ⏎on a Mac), and choose Add ‘JUnit4’ to classpath — IntelliJ will fetch the library and attach it itself.
To run your tests, click the green ▶ arrow in the gutter beside a test class or an individual test method, or right click the test file and choose
Run '...'. Results appear in the Run tool window, with failures linked back to the offending line.
Troubleshooting
Sometimes (especially if you had some issues while setting up your project and needed to redo it) IntelliJ gets confused and JUnit is not properly situated on the classpath.
If you’re getting an error related to the JUnit runner, try the following:
-
Check that the project knows where your code lives: right click the
srcfolder and chooseMark Directory as > Sources Root. If the skeleton has a separatetestfolder, mark that one asTest Sources Root. -
Check that a JDK is selected:
File > Project Structure > Project, then make sure the SDK field names a JDK.Toolkit
If that SDK dropdown is empty — or the JDK dropdown is empty when you create a new project — you can pull one straight from the IDE.
Use
Download JDK...there. This is all you need for the rest of the course; it installs to a JetBrains-managed folder rather than your system PATH, so it only fixes IntelliJ. Add the optional command-line install at the bottom of this page if you also wantjavacworking at the terminal. -
Re-check the dependency:
File > Project Structure > Modules > Dependencies, and confirmjunit.jaris listed with scopeCompile. -
If everything looks right but the errors persist, choose
File > Invalidate Caches...then Invalidate and Restart — this clears a stale index, which is the usual culprit.
Debug
If you cloned your assignment from PostCommit, open it with
File > Open...and select the cloned folder itself (the one containingsrc), then accept the “Trust Project” prompt. Opening a parent folder or a single file is the most common reason a skeleton appears to have no code in it.
Optional
Remark
Neither of the following is required. They exist for the very first lecture, where we compile and run a Java program by hand at the terminal — once, and I will demo every step of it live in class. Everything after that lecture runs through IntelliJ IDEA, which brings both an editor and a JDK of its own along for the ride.
Install them if you’d like to follow along on your own machine during that demo, or if you just like knowing what the IDE is doing for you under the hood.
Java at the Command Line
Toolkit
If you skip this, IntelliJ’s
Download JDK...option gets you the very same Temurin JDK — see the IntelliJ IDEA section above — and you will be all set.
Remark
Installing here and letting IntelliJ download one is harmless; you would simply have two copies. If you do this install first, the JDK will already be waiting in IntelliJ’s JDK dropdown and there will be nothing to download.
- Download Java:
-
Get the latest LTS JDK from Adoptium Temurin (click here) — no account signup required, and the installer wires up your system paths for you.
-
Run the install executable (.msi for Windows, .pkg for Macs) and follow the instructions on your screen.
Debug
On Windows, make sure the installer’s optional features for adding Java to your PATH and setting JAVA_HOME are enabled.
These are what let you run
javacfrom a terminal, which is the whole point of this install. -
Open either Terminal (Mac/Linux: CMD+Spacebar then search for Terminal) or Command Line (Windows: WINDOWS+R, then type
cmd, and enter). -
To test that the installation has succeeded, run the following commands (type these in the terminal one at a time then hit enter):
java -version javacIf you see no error messages from the above, you’re all set!
Remark
javacwork at the terminal. That is the one thing this install buys you.A JDK that IntelliJ downloads for you lands in a JetBrains-managed folder rather than on your system PATH, so it will not make
-
A Plain Text Editor
For that same first-lecture demo, we write a .java file outside of any IDE. Any plain text editor will do — your machine already has one
(Notepad, TextEdit) — but if you’d like something nicer, good suggestions:
Debug
Warning: You should NOT use Microsoft Word or other document processing software for your development, it will cause more trouble than good.
- Sublime Text (my favorite for Mac)
- Notepad++ (my favorite for Windows)
- Atom
- Vim (warning: steep learning curve, but my favorite for terminal)
- Emacs (warning: steep learning curve)