Lab 0: Intelli  J Setup
Summary
1 Installing JDK on your computer
1.1 Checking the installed version
1.2 Download and install JDK 11
2 IDE Installation
3 Working on projects in Intelli  J
3.1 Creating a new project in Intelli  J
3.2 JUnit Testing
3.3 Code styling
8.9

Lab 0: IntelliJ Setup

Starter files: code.zip

Summary

This lab covers the following topics:

You can try to work through this setup lab before your scheduled lab if you like. If you get stuck, you can ask the TAs for help in lab — but on Friday, they will be introducing you to writing your own tests and debugging in IntelliJ.

1 Installing JDK on your computer

Note: you are welcome to play with newer features of Java on your own, but the handin server only supports Java 11, so you must ensure that your code runs correctly in that version.

In order to run/execute Java programs, the JRE (Java Runtime Environment) must be installed on your computer. In order to develop Java programs, the JDK (Java Development ToolKit) must be installed.

We will use Java 11 JDK in this course (the JRE can be 11 or later).

1.1 Checking the installed version

You can check the version installed on your machine as follows:

  1. Open the command prompt (on Windows) or the terminal (Mac/Linux).

  2. Type javac -version and press Enter. This checks the JDK version.

  3. Type java -version and press Enter. This checks the JRE version.

1.2 Download and install JDK 11

Please follow these instructions:

  1. Go to https://www.oracle.com/java/technologies/javase-downloads.html. If the link does not work, do a web search for "Java JDK downloads" and go to the oracle.com page in the results.

  2. On that page, scroll down to find Java 11 and download the version for your operating system. (Note for Mac users: If you have a Mac with an M1 or M2 processor (i.e. model year 2020 or newer), be sure to install the amd64 version of the JDK, and not the x86 version.) If the download works, proceed to the installation steps.

    • If you get a 404 error or cannot download it, try the following. Return to the link above. There should be a Java archive "tab". Click on that. This will take you to a list of previous Java releases.

    • Make sure Java SE is selected on the left menu. On the right are a list of links. Click on Java SE 11.

    • Download the JDK for your operating system. (Note for Mac users: If you have a Mac with an M1 or M2 processor (i.e. model year 2020 or newer), be sure to install the amd64 version of the JDK, and not the x86 version.)

  3. Run the installer to install JDK on your computer.

  4. Verify the installation by checking the JDK version as described in the previous section.

2 IDE Installation

We will use Jetbrains’ IntelliJ IDEA as our integrated development environment for this course. This IDE is available in two flavors: Community Edition and Ultimate Edition. Although the latter is not free, each Northeastern student can get the Ultimate Edition for free if they use their @northeastern.edu or @husky.neu.edu accounts to register on Jetbrains website. We recommend the Ultimate Edition as it has a few plugins that you may find useful (the Community Edition should still be enough for all the work in this course).

Follow these instructions to download IntelliJ:

  1. Go to https://account.jetbrains.com/login.

  2. If you have not registered yet, use your @northeastern.edu or @husky.neu.edu account to register for a Jetbrains account. Follow the instructions in subsequent emails to complete the account creation.

  3. Login to your account, and apply for a new student license.

  4. Once you see the license approved in your account, you will download a specific version of IntelliJ. The reason for this is the newer versions have some bugs on newer computers (Macs specifically). Click on IntelliJ IDEA Ultimate on the license page.

  5. Then click on the big download button to be brought to the download page. Scroll down to find Java 11.

  6. From this new page, scroll down to version 2023.2 and download your specific version. Of note:

    • If you have the M1 or higher chip on a Mac (i.e. model year 2020 or newer), download the Apple Silicon version

    • If you have a Mac without that chip, download the macOS version

    • For most Windows laptops, you should be fine with the x64 version.

3 Working on projects in IntelliJ

Before starting to work in IntelliJ, the following are strongly recommended:

3.1 Creating a new project in IntelliJ

You should generally create a new project in IntelliJ for every assignment. You may group assignments into a single project if they progressively build the same program.

The instructions below create a simple project called Lab1.

Once you’ve created your project, continue with the following:

3.2 JUnit Testing

We will use the JUnit testing framework to write all our tests in this course. JUnit is not part of the JDK, and therefore is likely not installed on your computer. We will be downloading JUnit from Maven.

For each project, you should put all the tests in a separate folder. This allows you to cleanly separate your code from your tests.

3.3 Code styling

IntelliJ can help you style your code so that it adheres to a pre-defined standard. Follow these steps to set up and use code styling:

Keep in mind that IntelliJ does not automatically reformat code according to the imported style file: you must manually reformat each file. Also, the imported style file does not fix all the errors flagged by the submission server.