Setting up the environment in Scala - GeeksforGeeks

16 Nov, 2021
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 PackagesThe 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 ScalaWe 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:
Click on the NEXT buttonClick on the NEXT button as shown in the image.Now this screen will appearCheck the “I Agree Option” and then click NEXTMove on to InstallingClick on the INSTALL button.The installation Process startsAllow the packages to installThe Installation is OverClick on the FINISH buttonNow the Packages are ready and we are all set to go for using Scala.
Click on the NEXT buttonClick on the NEXT button as shown in the image.
Now this screen will appearCheck the “I Agree Option” and then click NEXT
Move on to InstallingClick on the INSTALL button.
The installation Process startsAllow the packages to install
The Installation is OverClick on the FINISH buttonNow the Packages are ready and we are all set to go for using Scala.
Now the Packages are ready and we are all set to go for using Scala.
Step 3:Testing and Running the Scala CommandsOpen 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+5scala>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.
ManasChhabra2
nidhi_biet
varshagumber28
Picked
Scala
Scala-Basics
Scala
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
For Loop in Scala
Scala | flatMap Method
Scala List filter() method with example
Scala Tutorial – Learn Scala with Step By Step Guide
Scala | map() method
Scala | reduce() Function
String concatenation in Scala
Throw Keyword in Scala
How to install Scala on Windows?
Type Casting in Scala