Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install Scala on Windows 10

Install a JDK, download Scala, set the environment variables and start the Scala REPL.

Windows Hosting2 min read7 steps5 screenshots

Requirements

  • Windows 10.
  • A JDK, version 8 or later. Install it first and check with java -version.

Step 1: Download Scala

Open the Scala website (scala-lang.org), go to Download and get the Windows package (a zip file with the binaries, or the installer).

The Scala website

Step 2: Extract Scala

Extract the zip file to a folder such as C:\scala.

Extracting Scala

Step 3: Set the environment variables

  1. Search for environment variables in the Start menu and open Edit the system environment variables. Click Environment Variables.
    The system variables
  2. Under System variables, create SCALA_HOME with the value C:\scala (the folder you extracted).
  3. Select Path, click Edit, click New and add %SCALA_HOME%\bin.
    Editing the environment variables
  4. Click OK in all windows.

Step 4: Check the install

Open a new Command Prompt:

scala
The Scala shell

The Scala interactive shell (REPL) opens. Leave it with :quit. Recent Scala 3 downloads use scala and scalac commands; older ones may need scala -version to check.

Basic use

Try these in the shell:

println("Hello, World!")

Values and variables:

val name = "Bob"
var age = 15

A function:

def greet(name: String): String = {
  s"Hello, $name!"
}

Common problems

  1. Java not found. Install a JDK and check that JAVA_HOME and the Path are right.
  2. Environment variable errors. Check that the Scala bin folder is in the Path, and open a new window.
  3. Incompatible Scala version. Use a Scala version that matches your JDK.

Tips

  • Use a package manager such as Chocolatey or Scoop to install and update Scala.
  • Use an IDE such as IntelliJ IDEA (with the Scala plugin) or VS Code (with Metals).
  • Use sbt to build bigger projects.

Quick recap

  • Install a JDK, extract Scala and set SCALA_HOME and the Path.
  • Run scala to start the shell.
  • Use sbt for projects.