Setting Up Your Scala Development Environment

Introduction

Before you can start writing Scala code, you need to set up your development environment. This lesson will guide you through the process.

Prerequisites

  • Java Development Kit (JDK) 8 or higher
  • A text editor or IDE
  • Terminal/Command prompt access

Installing the JDK

First, you need to install Java:

# Check if Java is already installed
java -version

# If not installed, download from Oracle or use OpenJDK

Installing sbt (Scala Build Tool)

sbt is the standard build tool for Scala projects:

# On Windows (using Chocolatey)
choco install sbt

# On macOS (using Homebrew)
brew install sbt

# On Linux
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
sudo apt-get update
sudo apt-get install sbt

Setting Up VS Code with Metals

  1. Install VS Code
  2. Install the Metals extension
  3. Install the Scala Syntax extension

Creating Your First Project

sbt new scala/scala3.g8

Summary

With your environment set up, you're ready to start your Scala journey!

What's Next

In the next lesson, we'll write your first Scala program.