Open In App

Setting up the environment in Scala

Improve
Improve
Like Article
Like
Save
Share
Report

Scala is a very compatible language and thus can very easily be installed into the Windows and the Unix operating systems both very easily. In this tutorial, we learn about how to move on with the installation and the setting up of the environment in Scala. The most basic requirement is that we must have Java 1.8 or a greater version installed on your computer. We’ll look into the steps separately for Windows and Unix.

Step 1: Verifying Java Packages
The first thing we need to have is a Java Software Development Kit(SDK) installed on the computer. We need to verify this SDK packages and if not installed then install them. Open the command window and type in the following commands:

For Windows

C:\Users\Your_PC_username>java -version

Once this command is executed the output will show the java version and the output will be as follows:

java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

we will get this output if java has already been installed

For Linux

$ java -version

Once this command is executed the output will show the java version and the output will be as follows:

java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)

If we get the above output then we have the latest java SDK installed and we are ready to move on to STEP 2. In case we are not having the SDK installed then download the latest version according to the computer requirements from https://www.oracle.com/technetwork/java/javase/downloads/jdk12-downloads-5295953.html and just proceed with the installation.

Step 2: Now install Scala
We are done with installing the java now let’s install the scala packages. The best option to download these packages is to download from the official site only: https://www.scala-lang.org/download/ The packages in the link above is the approximately of 100MB storage. Once the packages are downloaded then open the downloaded .msi file and follow the screenshots given below:

  1. Click on the NEXT button

    Click on the NEXT button as shown in the image.
  2. Now this screen will appear

    Check the “I Agree Option” and then click NEXT
  3. Move on to Installing

    Click on the INSTALL button.
  4. The installation Process starts

    Allow the packages to install
  5. The Installation is Over

    Click on the FINISH button

    Now the Packages are ready and we are all set to go for using Scala.

Step 3:Testing and Running the Scala Commands
Open the command prompt now and type in the following codes

C:\Users\Your_PC_username>scala

We will receive an output as shown below:

Output of the command.

Now since we have Scale installed in the system we can now write some commands to test some Scala statements:




scala>println("Hi, Learning Scala")
scala>4+5
scala>6-2



The output of the above commands.

The Scala environment is now ready to use. We can now work on Scala by typing in the commands in the command prompt window.


Last Updated : 16 Nov, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads