Scala Environment Setup


Advertisements


The Scala language can be installed on any UNIX-like or Windows system. Before you start installing Scala on your machine, you must have Java 1.5 or greater installed on your computer.

Installing Scala on Windows:

Step (1): JAVA Setup:

First, you must set the JAVA_HOME environment variable and add the JDK's bin directory to your PATH variable. To verify if everything is fine, at command prompt, type java -version and press Enter. You should see something like the following:

C:\>java -version
java version "1.6.0_15"
Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
Java HotSpot(TM) 64-Bit Server VM (build 14.1-b02, mixed mode)

C:\>

Next, test to see that the Java compiler is installed. Type javac -version. You should see something like the following:

C:\>javac -version
javac 1.6.0_15

C:\>

Step (2): Scala Setup:

Next, you can download Scala from http://www.scala-lang.org/downloads and install windows binaries. Finally, open a new command prompt and type scala -version and press Enter. You should see the following:

C:\>scala -version
Scala code runner version 2.9.0.1 -- Copyright 2002-2011, LAMP/EPFL

C:\>

Congratulations, you have installed Scala on your Windows machine. Next section will teach you how to install scala on your Mac OS X and Unix/Linux machines.

Installing Scala on Mac OS X and Linux

Step (1): JAVA Setup:

Make sure you have got the Java JDK 1.5 or greater installed on your computer and set JAVA_HOME environment variable and add the JDK's bin directory to your PATH variable. To verify if everything is fine, at command prompt, type java -version and press Enter. You should see something like the following:

$java -version
java version "1.5.0_22"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03)
Java HotSpot(TM) Server VM (build 1.5.0_22-b03, mixed mode)
$

Next, test to see that the Java compiler is installed. Type javac -version. You should see something like the following:

$javac -version
javac 1.5.0_22
javac: no source files
Usage: javac <options> <source files>
................................................

$

Step (2): Scala Setup:

Open your terminal and run the following commands as shown below

$ wget http://www.scala-lang.org/files/archive/scala-2.11.4.deb
$ sudo dpkg -i scala-2.11.4.deb
$ sudo apt-get update
$ sudo apt-get install scala
Finally, open a new command prompt and type scala -version and press Enter. You should see the following:

$scala -version
Scala code runner version 2.11.4 -- Copyright 2002-2013, LAMP/EPFL

Congratulations, you have installed Scala on your UNIX/Linux machine.



Advertisements