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

Table of contents
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
- Open IntelliJ IDEA
- Go to
Settings
(orPreferences
on macOS) - Navigate to Plugins
- Search for Scala
- Click Install
- Restart the IDE
✅ Now IntelliJ knows how to compile and run Scala code!
📦 Step 3: Create a New Scala Project
- Click on New Project
- Choose Scala from the left menu
- Under Build System, select sbt
- Set your project name, location, and Scala version
- 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 → New
→ Scala 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
New
→Scala 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]
Subscribe to my newsletter
Read articles from Saiprasad Vyawahare directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
