Using the IntelliJ IDEA

IntelliJ IDEA is an Integrated Development Environment (IDE) from the company JetBrains. IntelliJ was developed for the Java programming language, but it also has excellent support for Scala via an official plugin.

IntelliJ is the programming environment most of you used in Programming/Ohjelmonti 1, and because it supports sbt projects, you may use it also in this course.


The A+ plugin used in Programming/Ohjelmonti 1 course is not supported in this course. You have to download the exercises and upload your solutions to A+ using your browser.

IntelliJ is already installed on the Aalto Linux machines in the computer labs. To start it open a program menu or terminal and run idea.

Installing IntelliJ on your own computer

First, if you have used IntelliJ in other courses, you may already have it on your computer. In that case, there is no need to install it again. Simply, make sure that you have updated it to the latest version. You can do this by clicking the ‘cogwheel’ icon in the bottom left corner of the IntelliJ IDEA welcome screen (see figure in next section) and pick Check for Updates in the menu that appears.

Fresh install

To install from scratch, go to the IntelliJ IDEA Downloads page and pick the installer suitable for your system and run it. Make sure to pick the free Community edition of IntelliJ IDEA.

Note that, if you use a package manager (for example on a Linux system) it is likely that you can use this to install IntelliJ directly, without the need to download a separate executable.

After the installation has finished, you should be able to run IDEA from the start/applications menu on your system and be greeted with a welcome screen similar to in the figure below.


Welcome screen shown when you start IntelliJ IDEA. The tab menu on the left lets you choose between Projects, Plugins, and more. (The ‘cogwheel’ in the lower left corner, this will open a menu allowing you to check for updates, and make advanced settings.)

Installing the Scala language plugin

In order to use IntelliJ with the Scala programming language, you will need the official Scala Language plugin. To install it, select Plugins on the welcome screen, and make sure you are viewing the Marketplace. If needed, search for “Scala” in the Marketplace, select the one from JetBrains, and choose to Install it.


Installing the Scala plugin. Select the Plugins tab from the left-hand menu, and make sure you are viewing Marketplace at the top. Then search for and install the “Scala” plugin from JetBrains.

Working with the exercises

Download the exercises package from A+ and unpack it to your computer. Then use the Open button in the Projects tab on the Welcome screen and navigate to the exercise directory you just unpacked.

Select the build.sbt file (or you can just choose to open the whole folder, but make sure it is the right one). If you are asked how you wish the open, choose Open as a Project (not as a file).


Choose Open from the Project tab and navigate to the exercise folder.

When asked if you want to Trust and Open the project, select Trust Project (you may also want to click in the check-box to automatically trust all projects put in the same containing folder, which is handy if you are only planning on storing course project there).


Treat trust seriously. Build scripts, such as those of sbt, are often full-fledged scripting languages in themselves, and they have the power to read and write files on your computer. For example to seamlessly install missing libraries and execute components as needed. This is why many modern development tools, such as VS Code and IntelliJ, asks you if you trust a project before it imports a project. Take this seriously. If you are uncertain if you trust the authors of a software project you have just downloaded, it is often safest to choose to open it in a preview-mode first. For this course, however, we hope that you trust the teaching staff sufficiently to import the exercises.

IntelliJ will now create the build files for the project, and download any missing Java/Scala libraries needed to build it. The first time you open a project this can take a bit of time.

Running tests and code

Source code containing a main function or tests can be run by clicking the ⏵ buttons next to the line number in the source file. You can also right-click on the file name in the Project tab and choose the corresponding Run action from the context menu, or from the Run menu at the top of the window.

Test results and program output are shown in the “⏵ Run” tab at the bottom of the screen.


Tests and programs can be run from the source code (for instance) and the output is shown in the “⏵ Run” tab at the bottom of the screen.


Unit tests and A+ grading performs different tasks. Just because your code passes all unit tests does not guarantee a full score by the grader. On the other hand, you may not necessarily need to solve all the tasks in an exercise to submit your solution for grading and get some points. Most exercises award points for every individual task, so you can get points from an exercise even if some unit tests fail. (But in the real world for professional programming, never ship code which fails a unit test.)

Opening a Scala REPL

There are a few different ways to get a Scala REPL in IntelliJ:

  1. If you only wish to test out some Scala code, you can open up a Scala REPL inside IntelliJ from the menu ToolsScala REPL… (or by pressing Ctrl+Shift+D).

Note that while you can execute Scala code in this REPL, it is not always well formatted, and this REPL not aware of the exercise structure, so you may have trouble importing code from your own files.

  1. A more elaborate way to get a REPL where you can also import your exercise code is to start a console through sbt.


scalac: Token not found:

This error message can appear when you run/test/compile a program due to what seems to be an IntelliJ bug. The fix is to stop and then re-start the Scala Compile server before running/testing/compiling the program again. You can do this by clicking on the small watch/meter icon in the bottom right IntelliJ toolbar.


To restart the compile server from this menu, first Stop it then Run it again.