Pages

Thursday, 7 April 2022

Scala - Installation Guide ( Step By Step )

    

Scala is JVM based language and require Java JDK installed


Steps to install Scala locally : 

1. Check if you have Java already installed by using below command on command line.

  • Press Window+R and Type "cmd" then hit enter

  • Type "java -version" to check java version installed on your system.



If you see java version as shown in above screenshot, then move to step 2
else install Java JDK from oracle website and then check again "java -version" and then move to step 2.


2. Download Scala latest version (2.* or 3.*) and install it on your system

  • Go to website -  https://www.scala-lang.org/download/
  • Click on - Pick up specific Release
  • Click on version (example : Scala 3.1.1) then follow installation steps from landing page.

3. After installation, open command line ( Window + R and type cmd ). Type scala to go to scala prompt as shown in below screenshot. This completes your scala installation and you can shoot commands in interactive mode (REPL).




4. To Run scala code from .scala file

  • Write a simple code in txt file and save it as test.scala
  • Run scala code in file from scala prompt using below command.




 





 scala> scala test.scala


5. To run multiple line code from scala prompt - Use "paste"

To Enter paste mode - type :paste then enter
Type multiple line code
To exit paste - Control+D























keywords : 
how to install scala on windows,  scala interview questions, scala tutorial, scala vs python.
JDK, scala version, quick scala setup

No comments: