Scala Programming using IntelliJ IDEA

Table of Contents

Introduction

This article discusses reasons for switching to IntelliJ IDEA for writing Scala as an alternative to Eclipse. We also show how to do the setup. IntelliJ IDEA is a Java IDE from JetBrains, which supports Scala. IntelliJ’s youtube channel contains more material and guides for those who are interested.

Reasons to Use IntelliJ

Here are some reasons why I use IntelliJ.

  • It’s easy and intuitive to learn for people of any skill level.
  • It has a user-friendly and sophisticated interface.
  • It has an option to choose a dark theme, such as Darcula, which is much more pleasant for the eyes, especially later in the evening.
  • It uses Source Code Pro font by default, which is font designed for programming.
  • It has powerful refactoring and static code analysis tools.
  • It is intended to be used with the keyboard and doesn’t require a lot of mouse movement.

Setting Up IntelliJ IDEA

The official IntelliJ IDEA guide offers in-depth details for using IntelliJ and contains Scala section. Here is the list of steps to get up and running with IntelliJ.

  1. Request for a student license. With a student license, you can get the professional versions of JetBrains products for free.
  2. Download IntelliJ IDEA. If you applied for a student license, download the Ultimate edition; otherwise, download the Community edition.
  3. Install the Scala plugin.
  4. Optional: Set theme to Darcula.
  5. Linux users: Make desktop entry, by searching from settings create desktop entry.

Importing a Project

In this section, we show how to import a project for the Aalto University Scala programming courses. We use the CS-A1140 Data Structures and Algorithms course files as an example.

  • Project dependensies: A1140-libs.zip
  • Project file. E.g. A1140-r1-peakFinder.zip

Import Eclipse project files

  1. Open IntelliJ Idea
  2. Choose Import Project
  3. Select the extracted project files folder. E.g. A1140-r1-peakFinder
  4. Choose to import as Eclipse project
  5. Keep pressing next and finally press finish

Setting up Scala SDK

  1. Set scala SDK by opening exercise file in IntelliJ and pop should suggest to setup scala SDK.

Setting up the dependencies

  1. Open project structure window
  2. Select modules choose Dependencies tab
  3. Press the plus sign to add new dependencies
  4. Select all the .jar files inside the A1140-libs/lib directory
  5. Press OK

Contribute

If you enjoyed or found benefit from this article, it would help me share it with other people who might be interested. If you have feedback, questions, or ideas related to the article, you can contact me via email. For more content, you can follow me on YouTube or join my newsletter. Creating content takes time and effort, so consider supporting me with a one-time donation.

Jaan Tollander de Balsch
Jaan Tollander de Balsch

Jaan Tollander de Balsch is a computational scientist with a background in computer science and applied mathematics.