At the time of this post Scala has been grown for a stable stage and the latest version of Scala is 2.11.2.
We can download the latest release from scala download where we’ll find download packages for different operating systems. There are 3 ways to install scala but I like to create my scala projects using Typesafe Activator. Typesafe Activator is a browser-based or command-line tool that helps developers get started with Scala quickly.
Installing binaries
Simply download the binaries and unpack the archive
Now to quickly access, add scala and scalac to path variables.
Environment | Variable | Value (example) |
---|---|---|
Unix | $SCALA_HOME | /usr/local/share/scala |
$PATH | $PATH:$SCALA_HOME/bin | |
Windows | %SCALA_HOME% | c:\Progra~1\Scala |
%PATH% | %PATH%;%SCALA_HOME%\bin |
Open your terminal and type scala it will change to scala interactive interpreter (Figure 1). Now that we are ready, can try some single line of Scala code like arithmetic expression and enjoy the beauty of scala ☺. Eg :- 2+3 = 5
Typesafe Activator
The Typesafe Reactive Platform provides developers with the most powerful tools to build modern applications that react to events, react to load, react to failure, and react to users. Typesafe Reactive Platform consist of these following popular frameworks
All these technology are bundle together and the platform is distributed through Typesafe Activator, a browser-based tool that includes easy-to-use templates and tutorials. To install Typesafe Activator watch the following video:
Once it’s up and running use command or browser application to create scala template and start to work on it.
Editor
Scala project can be setup on Eclipse but I would recommend to work on IntelliJ IDEA . It has a great support with scala and sbt build tool.
To work on IntelliJ IDEA we need to install the scala plugin. To install scala plugin follow the step (Figure 2) and you will be able to install the plugin successfully.
Click the Preference (1) button and Preference Window (2) will be opened. In preference window select Plugin (3) from the list and press Install Jetbrains plugin (4). Now a new Plugins window (5) will be open from it search for Scala plugin (6) using the plugin search bar. That’s it , after selecting the scala plugin in right panel Install (7) button will appear. Since I have already installed the scala plugin it’s not visible on the screen shot.
Well, now we are ready with development environment ☺. Lets start with our mandatory “Hello World” program :D.