Note: You can skip this page if you are okay with using CloudxLab environment. Instructions below are for installing Scala on your PC.
Since Scala code is compiled to Java Bytecodes, Scala installation requires Java Software Development Kit (SDK) installed on the machine.
On CloudxLab, Scala is already installed and readily available in the right-hand side frame. The right-hand side frame is essentially Jupyter which is an online environment for programming, analytics and machine learning.
If you want to use scala elsewhere you might have to go for the installation as outlined below.
java –versionin terminal
Set Your Java Environment
Here, java-current is the directory where java is installed
Add java to the path
Download Scala from http://www.scala-lang.org/downloads. Current version downloaded file is - scala-2.12.7.tgz and it is downloaded to ~/Downloads Unpack Scala binary
cd ~/Downloads tar -xvf scala-2.12.7.tgz sudo mv scala-2.12.7 /usr/local/ sudo chmod -R 755 /usr/local/scala-2.12.7/bin export SCALA_HOME=/usr/local/scala-2.12.7/ export PATH=$PATH:$SCALA_HOME/bin
Add the last 2 lines from above in .profile or .bash_profile to set the paths permanently.
scala command and you should get scala prompt.
$ scala Welcome to Scala 2.12.7 (OpenJDK 64-Bit Server VM, Java 10.0.2). Type in expressions for evaluation. Or try :help. scala> print("Hello"); Hello scala>
Taking you to the next exercise in seconds...