Install the Scala command-line tools for Windows using the official instructions. Scala CLI can compile and run a source file. Older Scala 2 distributions also provide scalac and the classic scala runner. Follow the official installation guide, then verify the installation with scala version. The screenshots below illustrate an older Windows installation. Use the paths and versions for your machine.
A simple example
Run a first program
Start withA source file
Do thisRun the program
ResultReady
Print a single word to check that your tools can run a program.Lesson.scala
object Lesson extends App {
println("Ready")
}
Output
Ready
Get a school laptop ready for class
A coding club shares its Windows laptops between classes. Open a fresh terminal and run scala version. A version line tells the next student that the shell can find the Scala tool.
Java Development Kit (JDK) setup on Windows
Open a new terminal and run javac -version. If the command is unavailable, install the tool or check your PATH.
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. Locate the directory containing javac.exe. Copy its path.
2. Press Windows + R and enter rundll32.exe sysdm.cpl,EditEnvironmentVariables to open Environment Variables.
Alternatively, search Windows for “environment variables”.
3. Under User variables, select Path and choose Edit.
4. Select New, paste the directory you copied, and confirm with OK.
5. Open a new terminal and run javac -version to verify that Windows can find the tool.
6. With the JDK available, configure the language tools next.
Advertisements
Scala Standalone Command Line Compiler setup on Windows
Open a new terminal and run scala version. If the command is unavailable, install the tool or check your PATH.
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. Locate the directory containing the Scala launcher. Copy its path.
2. Open the Windows Environment Variables dialog.
3. Select New, paste the directory you copied, and confirm with OK.
4. Open a new terminal and run scala version to verify that Windows can find the tool.