How to install Java, Scala, and SBT on Linux Mint

Lately I’ve been in the process of “making the switch” from macOS to Linux Mint, and to that end, I just installed the Java 8 JDK/SDK, Scala 2.12, and SBT 0.13 on a new Linux Mint system, and I want to note here how I did that while it’s still fresh in my mind. Here are my notes in a compact form.

Update: Possible alternative

I haven’t looked into this yet, but it may be possible (and easier) to install OpenJDK rather than Oracle’s version of Java (which I describe below). I describe that process on my notes on how to configure a new Ubuntu server, but the basic command to install the OpenJDK JRE is:

apt-get install default-jre

and the command to install the OpenJDK JDK/SDK is:

apt-get install default-jdk

Installing the Oracle Java 8 JDK on Mint

The latest information I found on installing the Java JDK/SDK on Mint was at this tipsonubuntu page.

The commands:

sudo apt-get remove --purge openjdk*
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo apt-get -y install oracle-java8-installer

or this instead of the last two, use these:

sudo apt update; sudo apt install oracle-java8-installer

I then did this, per the prompt from the previous command:

sudo apt install oracle-java8-set-default

After that, Intellij IDEA found this JDK easily.

Installing Scala on Linux Mint

Installing Scala on Mint was simple:

sudo apt install scala

This brought in the most current version of Scala available at the time of this writing in May, 2017, Scala 2.12.2.

Installing SBT on Mint

Instructions for installing SBT on Debian per the SBT website:

echo "deb /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp:// --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt-get update
sudo apt-get install sbt

That did a lot of work that took a while, but later when I tried to use SBT, it did another download that took a long time:

> sbt test
Getting org.scala-sbt sbt 0.13.15  (this may take some time)...
lots of download-related info ...
downloading ...
    [SUCCESSFUL ] org.scala-sbt#collections;0.13.15!collections.jar (2936ms)
'compiler-interface' not yet compiled for Scala 2.12.2. Compiling...

Installing Intellij IDEA

I have also been using Intellij IDEA. To do that I installed it from their website as a tar’d and gzip’d file, started from the command line, then mostly just followed the prompts. The key was getting Java and Scala properly installed. I suspect it’s best to install those first, but I installed IDEA first, then installed Java, Scala, and SBT.

It looks like IDEA installs its own copy of SBT, but I often run SBT from the command line myself, so I installed it with apt.

I don’t remember the exact prompt, but at some point during the process, if you let IDEA install its own command to your desktop, that makes it easy to start it like a regular app.

Summary: Installing Java JDK, Scala, and SBT on Linux Mint

In summary, after these steps I was able to use the Java JDK/SDK, Scala, SBT, and Intellij IDEA on Linux Mint.