Setting Up Scala in IntelliJ IDEA (Step-by-Step for Beginners)

Setting Up Scala in IntelliJ IDEA (Step-by-Step for Beginners)

Ready to go beyond online editors? Let’s set up Scala on your machine using IntelliJ IDEA.


🚀 Why IntelliJ IDEA?

JetBrains IntelliJ IDEA is one of the most powerful and developer-friendly IDEs out there, especially for JVM-based languages like Java and Scala.

It offers:

  • ✅ Smart autocompletion and refactoring
  • ✅ Built-in sbt support
  • ✅ Great integration with Scala worksheets and test frameworks

🧰 Prerequisites

Before we start, make sure you have:

  • Java SDK installed (JDK 8 or above)
  • ✅ Internet connection to download IntelliJ and plugins

🧱 Step 1: Download and Install IntelliJ IDEA

👉 Go to https://www.jetbrains.com/idea/download
Download the Community Edition (it’s free and supports Scala with plugins).

Install it like any normal app.


🔌 Step 2: Install the Scala Plugin

  1. Open IntelliJ IDEA
  2. Go to Settings (or Preferences on macOS)
  3. Navigate to Plugins
  4. Search for Scala
  5. Click Install
  6. Restart the IDE

✅ Now IntelliJ knows how to compile and run Scala code!


📦 Step 3: Create a New Scala Project

  1. Click on New Project
  2. Choose Scala from the left menu
  3. Under Build System, select sbt
  4. Set your project name, location, and Scala version
  5. Click Finish

Wait for sbt to download dependencies — it might take a minute.


📄 Step 4: Add a Simple Scala File

Inside src/main/scala, right-click → NewScala Class → Name it HelloWorld

Paste the following code:

object HelloWorld {
  def main(args: Array[String]): Unit = {
    println("Hello from IntelliJ!")
  }
}

▶️ Step 5: Run Your Code

  • Right-click inside the main method or on the file
  • Choose Run HelloWorld

✅ You should see the output in the console: Hello from IntelliJ!

🧪 Bonus: Try a Scala Worksheet

Scala Worksheets allow you to write and evaluate code interactively. To create one:

  • Right-click on your src folder
  • Go to NewScala Worksheet
  • Name it Playground

Try typing:

val name = "Scala"
val version = 3.3
s"Hello $name $version"

You’ll see the result instantly on the right!

🎯 That’s It!

Now you have a full Scala development environment running locally with IntelliJ IDEA.

🔍 What’s Next?

Now that you’ve seen how easy it is to run Scala, here’s what you can do next:

👉 [How to Define Variables]

0
Subscribe to my newsletter

Read articles from Saiprasad Vyawahare directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Saiprasad Vyawahare
Saiprasad Vyawahare