Setting up the environment in Scala
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 packeges 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 button

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

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

Click on the INSTALL button. - The installation Process starts

Allow the packages to install - The Installation is Over

Click on the FINISH buttonNow 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.
Recommended Posts:
- How to set PHP development environment in windows ?
- How to get the value of System Property and Environment Variable in Java?
- Set in Scala | Set-1
- Scala | Either
- Scala Map
- Set in Scala | Set-2
- How to get all the values from a Scala map
- How to get all the keys from a Scala map
- StringBuilder in Scala
- while and do while Loop in Scala
- Scala | ArrayBuffer
- TreeSet in Scala
- ListMap in Scala
- Scala | Tuple
- How to sort a Scala Map by key
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



