Installing Scala on Ubuntu 14.04

Downloaded latest scala … Tried to run the interpreted.

Could someone translate what this means for me, or point me to online docs which describe more guidance on installation?

Exception in thread "main" java.lang.UnsupportedClassVersionError: scala/tools/nsc/MainGenericRunner : Unsupported major.minor version 52.0
	at java.lang.ClassLoader.findBootstrapClass(Native Method)
	at java.lang.ClassLoader.findBootstrapClassOrNull(
	at java.lang.ClassLoader.loadClass(
	at java.lang.ClassLoader.loadClass(
	at sun.misc.Launcher$AppClassLoader.loadClass(
	at java.lang.ClassLoader.loadClass(
	at sun.launcher.LauncherHelper.checkAndLoadMain(

You need Java 8 for running scala 2.12.x. You probably have 6 or 7.

Longtime Ubuntu user here. What versions of Scala and the JRE are you
running? Did you install Scala and Java with apt?

I ask because JVM-related software in the repos is often very far out of
date, and the error you posted makes me suspect a version mismatch.

I recommend installing a JRE or JDK using this PPA:

And installing Scala by downloading one of the tarballs from

then unzipping it somewhere and adding the resulting bin/ dir to your path.

…:~$ java -version
java version "1.7.0_131"
OpenJDK Runtime Environment (IcedTea 2.6.9) (7u131-2.6.9-
0ubuntu0.14.04.2)> OpenJDK 64-Bit Server VM (build 24.131-b00, mixed mode)

I’m guessing that’s 7.

…:~$ sudo apt-get install openjdk-8-jre
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package openjdk-8-jre
…:~$ sudo apt-get install openjdk-7-jre
Reading package lists… Done
Building dependency tree
Reading state information… Done
openjdk-7-jre is already the newest version.
openjdk-7-jre set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

sudo apt-get update was already done ahead of these.

I’m good now. Thanks to all. I’m not sure exactly how I got the most recent Java, but I apparently did. And I got Scala via apt-get:

...:~$ scala
Welcome to Scala version 2.9.2 (OpenJDK 64-Bit Server VM, Java 1.7.0_131).
Type in expressions to have them evaluated.
Type :help for more information.

scala> 0
res0: Int = 0

scala> exit
warning: there were 1 deprecation warnings; re-run with -deprecation for details

you may want to vote for this, but its been open for almost 3 years:


Scala 2.9 is three versions out of date; I wouldn’t recommend using it since you won’t be able to take advantage of pretty much anything that has been written for Scala in the last four years.

You should get Java 8 and use SBT to manage your Scala versions. See for instance

for a description of what to do.

1 Like

Thank you.

But you must know if the intent is to attract people who want to use Scala for solving problems, things like Java 8 and SBT are additional hurdles they need to overcome, which is likely to discourage them.

While I’m a strong functional programming advocate, and have a good deal of programming experience, I’m primarily a statistician and quant engineer. While I’ll learn Scala-as-Spark glue, with the current arrangement, I’m more likely to stick with R for anything serious.

Agreed about Scala 2.9; it’s not a good idea to use it these days,
especially if you’re starting fresh.

Using SBT is the best way to manage Scala versions when developing
"real" projects, but if the OP just wants a REPL to try things out - and
it sounds like they do - unzipping a tarball from (and
installing Java 8 via the webupd8 PPA) is probably the easiest way.

Just FYI, SBT is NOT required to use Scala.

Also, Java 7 hit EOL more than 2 years ago, in the Spring of 2015.

For the moment you can still use Scala 2.11.11 if you are stuck on an outdated Java version for some reason. Scala 2.9 is far from recommended.

It is a bit of a hurdle, but you wouldn’t have had most of these problems if you’d been using a modern Ubuntu instead of 14.04. You would have the same problems if you tried using R for ATAC-seq analysis using only the packages available in 14.04. Or if you wanted to use Swift. Or Julia.

Hurdles are unfortunate, but you add extra ones if you want to use cutting-edge technology on top of a comparatively old distribution. You can do it–it isn’t even very hard! But the defaults are, unsurprisingly, wrong.