Scala is a new evolving programming language, its a JVM based language written in Java, it can use Java Libraries, if you are new to scala and want to go for the development, you can follow the steps below and make use of things in better manner.
One of these days I heard about scala from a friend and I thought to give it a try but how do I set it up in my linux environment.
Of course there are clear instructions on the setting it up by setting the path and environment variable but I guess that happens when you do an install via installer, isn't it? But I got a ".tgz" file so how do I proceed further, to answer this here are the steps to follow.
- 1. Download it.
- 2. Extract it.
- 3. Move it to the right location(it could be wherever you want).
- 4. Register the links of the executable binaries in system database(I would rather say, making the shortcuts, so that we can access it easily).
- And we are done.
So lets get started.
1. Download it, I mean download scala here.
2. Extract it. Now either you'll just right click on the compressed archive or you'll like to use terminal to type following command.
tar zxf scala-2.10.3.tgz
this will extract the directory and then you can move it wherever you like.
3. Now we are at out third step. linux always have some permissions to set so instead using GUI i use the terminal to do the purpose.
sudo mv Downloads/scala-2.10.3 /usr/share/scala
this will do.
4. Final step is to making and registering the links and we are done. following commands will make all the necessary links to the executable binaries.
sudo ln -s /usr/share/scala/bin/scala /usr/bin/scala
sudo ln -s /usr/share/scala/bin/scalac /usr/bin/scalac
sudo ln -s /usr/share/scala/bin/fsc /usr/bin/fsc
sudo ln -s /usr/share/scala/bin/sbaz /usr/bin/sbaz
sudo ln -s /usr/share/scala/bin/sbaz-setup /usr/bin/sbaz-setup
sudo ln -s /usr/share/scala/bin/scaladoc /usr/bin/scaladoc
sudo ln -s /usr/share/scala/bin/scalap /usr/bin/scalap
We are almost done, but remember scala uses the JVM to run so one thing you need already at hands is openJdk or oracleJdk. whichever one you like you can install using either your software center or
sudo apt-get install openjdk-7-jdk
that will do for now, and typing scala in the terminal shall now take you to the scala interactive environment which will look somewhat like this:
Welcome to Scala version 2.10.3 (OpenJDK 64-Bit Server VM, Java 1.6.0_27).
Type in expressions to have them evaluated.
Type :help for more information.
if this happens you are ready to go with scala.