Thursday, January 1, 2015

Gearing up for Learning Scala

Scala, an acronym for Scalable language is defined by Wikipedia as an object-functional programming language. This post will be an introduction to setting up your environment for scala development and writing a hello world program in scala. We will deep-dive into the concepts of scala in later posts.

Installation


1. You should have JDK6 or JDK7 installed.
2. For installing scala build tool (sbt) on OSx, you can use the following steps
$brew update
$brew install sbt
3. Download the scala IDE for Eclipse. After downloading the archive for your operating system, unpack it and start eclipse.

Building your Scala Hello World program


1. Go to File --> New --> Scala Project.

2. Choose a Project name and Select Finish.

3. Select File --> New --> Scala Object to create a new object.

4. Enter Hello as the name of the object and greeter as the package name.

5. Change the source code as below:
package greeter

object Hello extends App{
  println("Hello, World!")
}

6. Save the file and select Run - Run from the menu. Chose to run as Scala Application.

7. You can see the output in the console: