Sponsored Links
Ad by Google
Scala is getting much and more mature, nowadays it becomes industry demanding technology. Although syntax is very much similar to Java, but what Scala makes different from Java is, it's fully supported functional programming as well as pure object oriented language, there is nothing so called primitive in Scala. Here is a detailed differences between Java and Scala.
Anyway, we are here to share the Scala installation steps. If you are very new to Scala than, I must say visit this link to catch the glimpse of Scala. The Scala installation guide is very much similar to Java installation.
In this article, I will show you how to install Scala SDK and than Scala IDE with Hello world program, for detail explanation of Hello World program must visit this link.
Verify java installation:
java version "1.8.0_71"
Java(TM) SE Runtime Environment (build 1.8.0_71-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.71-b15, mixed mode)
OK, Now time to install Scala.
Step 1. Download the latest version of scala from http://www.scala-lang.org/download/ , At the time of writing this tutorial latest stable version of scala is 2.11.8, you can download the scala-2.11.8.tgz file and save it in your software installation folder.
Step 2. Once download is completed,extract the downloaded tar file, below is the command to extract.
Open .bashrc file(Type vi ~/.bashrc in your terminal) and add below syntax.
Now time to download Scala IDE.
Than,
Go to file->New->Scala project
Provide the project name, it will create a project. Now right click on your project and
New->Scala object
Provide the name of scala object like HelloWorld.scala, below is the complete HelloWorld program.
OUT PUT:
Hello, world!
Anyway, we are here to share the Scala installation steps. If you are very new to Scala than, I must say visit this link to catch the glimpse of Scala. The Scala installation guide is very much similar to Java installation.
In this article, I will show you how to install Scala SDK and than Scala IDE with Hello world program, for detail explanation of Hello World program must visit this link.
Steps to install Scala SDK
Before scala installation, install Java, if you have not already installed Java than follow this step-by-step guide to install java.Verify java installation:
java -versionThe above command will print the java details on your terminal if installed, similar to below details.
java version "1.8.0_71"
Java(TM) SE Runtime Environment (build 1.8.0_71-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.71-b15, mixed mode)
OK, Now time to install Scala.
Step 1. Download the latest version of scala from http://www.scala-lang.org/download/ , At the time of writing this tutorial latest stable version of scala is 2.11.8, you can download the scala-2.11.8.tgz file and save it in your software installation folder.
Step 2. Once download is completed,extract the downloaded tar file, below is the command to extract.
tar -xzf scala-2.11.8.tgzStep 3. Set SCALA_HOME class path for quick and easy access, below is the command to set.
Open .bashrc file(Type vi ~/.bashrc in your terminal) and add below syntax.
#scala installation export SCALA_HOME=/home/subodh/software/scala-2.11.8 export PATH=$PATH:$SCALA_HOME/binStep 4. Scala SDK is installed, to verify type scala on your terminal,it will launch scala interactive shell.
subodh@subodh-Inspiron-3520:~/software$ scala Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_71). Type in expressions for evaluation. Or try :help. scala>Step5. Hello World in scala
scala> object HelloWorld { | def main(args:Array[String]){ | println("Hello, world!") | } | } defined object HelloWorld scala> HelloWorld.main(Array()) Hello, world! scala>Done !!
Now time to download Scala IDE.
Scala IDE
Download Scala IDE from this link, It's a eclipse based IDE. Once downloaded than extract it, and double click on eclipse executable file inside extracted folder.Than,
Go to file->New->Scala project
Provide the project name, it will create a project. Now right click on your project and
New->Scala object
Provide the name of scala object like HelloWorld.scala, below is the complete HelloWorld program.
object HelloWorld { def main(args:Array[String]){ println("Hello, world!") } }Right click on HelloWorld.scala and select Run As->Scala Application.
OUT PUT:
Hello, world!
Sponsored Links
0 comments:
Post a Comment