Installing Intellij IDEA for Scala development on Linux

April 27, 2016
by Rares Aioanei


Scala is a programming language that is starting to gain momentum in the last years. The popular TIOBE Index ranks it, as this article is written, as being more used than more popular languages like Haskell or Go. The TIOBE index, if you’re not familiar with the name, is the somehow-authoritative source of information regarding programming language popularity. From the beginning we want to clearly state that this is not, by any means, an article on the language itself. It just aims to get the user up and running with an IDE for writing Scala code in the shortest time possible. That being said, let’s get to it.

Installation and prerequisites

On Linux, the only prerequisite for installing Intellij IDEA, which is the IDE we’ll be talking about, is the Oracle Java JDK. This is a specific requirement, as you can’t use OpenJDK, so please note this before we start. So let’s make sure we have the right JDK installed.

Installing the Oracle JDK

Before we go further, please make sure you acknowledge if you have OpenJDK installed and if so, take note of this as you’ll have to specify the correct JDK – Oracle JDK instead of OpenJDK – for IDEA to work correctly with Scala projects.


On Ubuntu, you first have to add the PPA, as explained before :

 $ sudo add-apt-repository ppa:webupd8team/java
 $ sudo apt-get update
 $ sudo apt-get install oracle-java8-installer 

This is all you should need in order to have the Oracle Java Development Kit. Now, let’s check if the installation process completed correctly :

 $ java -version 

This should yield an output that looks like this :

java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode) 


On Debian, the commands are similar, so are the sources. If you have been warned about adding PPAs to a Debian system, that warning is very well funded. There have been users that used PPAs in one form or another on their Debian systems, perhaps thinking that, since Ubuntu is Debian-based, well, what could go wrong? So, if usually adding a PPA to a Debian OS is not the hottest idea, here it’s working, because the PPA is only created for Java, which is portable enough not to create problems. The commands are :

 # echo "deb xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
 # echo "deb-src xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
 # apt-key adv --keyserver hkp:// --recv-keys EEA14886
 # apt-get update
 # apt-get install oracle-java8-installer

Again, it is a good idea to check the Java version you have installed by using the command above, so you can check if the correct version was installed (and it was installed correctly), and if it is the default Java version on your system.

Redhat-based distributions

Oracle offers, besides the classic tar.gz format, rpm packages for Fedora/RHEL-based distros, so this will make it easier for you to install the JDK if you are a user of such distributions. Simply go to and press the download button next to the JDK, accept the license agreement and download the rpm for your architecture. Change directory to the location you chose as the destination for the rpm and type

 $ sudo rpm -Uvh jdk-$version-$arch.rpm

Installing Intellij IDEA

Except the location of the JDK which is different in Debian/Ubuntu and derivatives as opposed to RHEL/Fedora, the installation process for the IDE is pretty much the same between distributions. The screenshots we took are from an Ubuntu system, so the location of the JDK will differ in RHEL/Fedora, in that the JDK gets installed in /usr/lib in Debian/Ubuntu, while in RHEL/Fedora is in /usr/java. So if you keep that in mind, the rest of the process is pretty straightforward, using the below screenshots.

We arrived at the installation of Intellij IDEA. Go to the download page – – and select the tar.gz for download. Unpack it, change to the bin/ directory inside the unpacked directory and run the script. You should be taken to the initial setup screen, where you will be asked to select a theme. Then create a desktop entry if you so desire, going to the next screen, where we recommend you create a launcher script, so you can have IDEA available system-wide:

Customize IntelliJ IDEA-1

This where we’re getting at the Scala-specific parts of the initial setup : press Install at the Scala plugin section, and after this is finished, create a new project, as seen below :

IntelliJ IDEA-1 new project

and select Scala/SBT. The reason we’re doing this now is because Intellij IDEA has to download some libraries necessary for Scala development and we have to set up the JDK location, as specified below :

IntelliJ IDEA-1 oracle java

Again, if using Fedora/RHEL, change the location you see in the screenshot (/usr/lib/jvm/java-8-oracle) accordingly to the JDK location in /usr/java. As noticed in the below screenshot, IDEA downloads some libraries in the background, so please wait until this part is finished :

IntelliJ IDEA-1 hello world

Final information

That’s it, you should have Intellij IDEA installed and set up for Scala development. There’s a lot of good documentation on Scala on the Internet, and we’d recommend, if you wanna start with a book, Programming Scala by Wampler and Manning or, if you want to take more advantage of the functional parts of the language, Functional Programming in Scala by Chiusano and Bjarnason. Have fun with Scala and if you have an interesting project, share it!

Comments and Discussions
Linux Forum