Scala Installation on Windows and Linux

  • date 20th August, 2019 |
  • by Prwatech |
  • 0 Comments

How to Download and install Scala on Linux, Unix, and Windows OS

Installation of Scala Programming Language, Welcome to the world of Scala Programming Language Tutorials. In these Tutorials, one can explore How to Download and install Scala on Linux, Unix, and Windows OS. Learn More advanced Tutorials on How to install Scala on Linux, Unix, and Windows OS by taking an example from India’s Leading Apache spark training institute which Provides advanced Apache spark course for those tech enthusiasts who wanted to explore the technology from scratch to advanced level like a Pro. We Prwatech the Pioneers of Apache Spark training offering advanced certification course and Installation of Scala Programming Language to those who are keen to explore the technology under the World-class Training Environment. Today we will learn how to download Scala and then install Scala on Linux, Unix, and Windows OS. Scala runs on top of JVM, so you should have JDK 1.8 or higher version installed all ready to proceed with Scala installation. Since you are here to learn Scala, I am assuming that you know how to install Java on your system.

Download and Install Scala on Linux systems

Scala installation on Linux, Ubuntu, Mac OS X or any Unix based system is the same, so the below steps should work for any *nix system. Verify the JDK installation on your machine. Open the shell/terminal and type java -version and javac -version. Download and install Scala on Windows OS Download Scala Binaries from http://www.scala-lang.org/download/. As of writing, this post-Scala version is 2.11.8, so you should be getting a downloaded file as scala-2.11.8.tgz. Unzip the scala-2.11.8.tgz file using the following command as shown below. Download Scala Binaries Now we are in the home directory where Scala binaries are present. Just go to the bin directory.Just go to the bin directory. Now enter the scala shell as shown below. Now enter the scala shell as shown below This is the Scala REPL shell in which we can type programs and see the outcome right in the shell.

Prerequisite for Scala installation on windows

Verify the JDK installation on your windows machine by typing the following commands in the command prompt. JDK version should be 1.8 or above. Verify the JDK installation on your windows

Scala download and installation can be done in the following ways:

1. First, download the Scala setup from https://www.scala-lang.org/download/2.11.8.html and click on scala-2.11.8.msi extension 2.Double Click or Open scala-2.11.8.msi file and select Run. The Setup Wizard appears, click on Next and complete the installation process. Scala installer will set the Path environment variable too so that you can run it from anywhere.

Steps for Scala download and installation

 Click on next button Scala installation on windows Accept the license and click on  Next scala license Click on Next scala programing language distribution setup Click on Install ready to install scala programing language distribution  Wait a moment until status to complete instasaling scala programing And finally, click on Finish completed the scala programing language  Open the command prompt and navigate to the bin directory of the installed scala by typing scala as shown below: Open the command prompt and navigate

Scala sample program example:

Let us see how to write and execute a program in the shell. Below is a simple class student that we can define in the Scala shell. Scala sample program example Output: defined class Student Here we create a Student class and print the student details in the student details method by passing student id and age as a parameter. If there are no errors in the code, then a message “defined class Student” is displayed. Create the student object and invoke the student details method bypassing the student id and age. Output: defined class Student Returns: defined object Stud Now run the code by typing Stud.main(null) and you will see below output as shown in the image. Returns: defined object Stud That’s all for now for download and install scala on different operating systems, we will look into more Scala features in coming posts.

Intellij IDE:

For beginners in scala language, the most popular way to get Scala is either using Scala through sbt, the Scala build tool, or to use Scala through an IDE. By considering you have installed JDK 8 or above, you can install scala by installing an IDE such as IntelliJ, or sbt, Scala's build tool IntelliJ is an IDE for programmers who want to get started with scala in IntelliJ. You can build a scala project with IntelliJ and sbt. You can also test scala in IntelliJ. To download IntelliJ click on the link and choose download Community Edition. Once the download is complete install it and choose scala plugin available into IntelliJ software. The “Hello Prwatech” output you can see after run MainObject.scala program given below: MainObject.scala Looking forward to learning more advanced tutorials on Apache Spark course then get it done from India's leading Apache spark Training institute who can help you to learn the technology from 0 to advanced Level like a Pro.

Quick Support

image image