How to install Scala on Fedora Linux

This tutorial introduces how to install Scala 2.9.2 on 64-bit Fedora Linux 17. There are some changes needed to make scala work on Fedora Linux 17. Please check it out in the answer.

Install Java

Scala depends on Java, so please install Java first. In this tutorial, we installed JDK to: /usr/java/jdk1.6.0_24/lib/.

Install Scala from the Fedora yum repository

In the repository for Fedora 17, it is scala 2.9.2

# yum install scala

Prepare the Java environment for Scala

However, if you invoke scala directly after installed it, you will likely get an error message like this:

/usr/bin/scala: error: JVM_LIBDIR /usr/lib/jvm-exports/java does not exist or is not a directory

It looks there is something related to Java is not correct.

After checking /bin/scala and searching for Java, the first line that sets up a red flag is:

export JAVA_HOME=/usr/lib/jvm/java/

I don’t understand why the JAVA_HOME should be hard coded. I don’t want to change the files for Scala neither so that I need not to edit the file every time I update it.

So to make Scala happy, let’s prepare the directories for it.

Prepare the jvm-exports directory:

$ cd /usr/lib/jvm-exports/
$ sudo ln -s /usr/java/jdk1.6.0_24/lib/ ./java

Prepare the jvm directory:

$ cd /usr/lib/jvm
$ sudo ln -s /usr/java/jdk1.6.0_24/ ./java

By now, scala should work in Fedora 17 Linux.

Answered by anonymous.

Leave a Reply

Your email address will not be published. Required fields are marked *