Scala development requires Scala Build Tool (SBT) which requires JVM to be installed already because the Scala code is running in top of JVM. In other words
JRE to be installed first and then SBT to be installed.
JDK contains the Java Runtime Environment (JRE)
and JRE contains the Java Virtual Machine (JVM).
SBT is the only tool which will be responsible for compiling the Scala source code and it will generate a byte code as a
file with the same name with .class extension (for example HelloWorld.class) and rest of the executions
will be handled by JRE with the help of Java Virtual Machine (JVM).
Java Development Kit (JDK) configuration for Windows machine
Ensure your system was already loaded with the
JDK. To check that open the command prompt
and execute the command java -version,
it will show the installed JDK's version in the
command prompt only if exist otherwise download it from the official site and install it manually.
Install the JDK in the following default directory C:\Program Files\Java\jdk1.8.0_221 and you can move the JDK software to another location as per your wish.
Check the JDK is updated the Environment Variable or not, by opening the command prompt and execute the command java -version. It will show the installed JDK's version otherwise follow the below steps to setup the environment variable path.
Set Path of JDK in Windows system environment variables
1. Copy the path of the JDK's bin folder
2. Open the Environment variable dialog using the Windows Run. Press Win + R and run the command rundll32.exe sysdm.cpl,EditEnvironmentVariables
or open the Environment variable by windows search using the search text environment variable
3. Select the Path variable and click the Edit which is under User Variable
4. Click the New button and add the path C:\Program Files\Java\jdk1.8.0_221\bin and finally click the Ok button.
5. Open the new command prompt and execute the command java -version, it will show the installed JDK's version.
6. JDK configuration succussfully completed, let try our first java program in the next chapter.
Scala Standalone Command Line Compiler configuration for Windows machine
Ensure your system was already loaded with the Scala Compiler. To check that open the command prompt and execute the command scala -version, it will show the installed Scala Compiler's version in the command prompt only if exist otherwise download it from the official site and install it manually.
Unzip the downloaded version of Scala Compiler package in the following directory default directory C:\Program Files (x86)\scala and you can move the Scala Compiler to another location as per your wish.
Check the SBT is updated the Environment Variable or not, by opening the command prompt and execute the command scala -version. It will show the installed Scala's version.
Set Path of Scala Compiler in Windows
1. Copy the path of the SBT's bin folder
2. Open the environment variables dialog as mentioned above
3. Click the New button and add the path C:\Program Files (x86)\scala\bin and finally click the Ok button.
4. Open the new command prompt and execute the command scala -version, it will show the installed Scala code runner's version.
5. Scala Compiler configuration succussfully completed, let try our first scala program in the next chapter.