Scala is a JVM-based functional programming language widely used in data analytics. You can install Scala using the terminal and access it from the terminal. However, IDE support is inevitable these days. Therefore, this article explains how to set up Scala in IntelliJ IDEA and how to create a hello world Scala project in IntelliJ IDEA.

Requirements

Scala has a strict dependency on Java Development Kit. Please refer to the official Scala website for the required Java Development Kit for the latest Scala version or the Scala version you want to use. Then make sure that you have the required Java Development Kit installed on your system. If you don’t have it already, please follow our article: How to Install Oracle Java Development Kit on Linux.

As the title suggests, you need IntelliJ IDEA installed to set up Scala in it. If you haven’t by any chance and if you are using Linux, follow the article: Install the Latest IntelliJ IDEA on Linux.


Install Scala Plugin in IntelliJ

Step 1:
Start IntelliJ IDEA and go to Plugins from the welcome screen or go to File → Settings → Plugins if you have already opened a project.

Step 2:
Search for Scala and install the Scala Plugin.

Install the Scala plugin in IntelliJ IDEA

Step 3:
Restart the IDE if prompted.


Create a New Scala Project

Create a new project in IntelliJ. Provide the project name and location. Then choose Scala as the language. After selecting the language, choose the build system to be SBT and click on the “Create” button. Please note that Scala has a dependency on Java Development Kit. Make sure you have selected the compatible JDK version for the chosen Scala version.

Create a new Scala project in IntelliJ IDEA

Run the Scala Project

Once the project is created, click on the Play button next to the Main object to run the project.

Scala hello world in IntelliJ IDEA

Have you found this article useful? Please let me know below in the comments. Knowing someone found my articles useful motivates me to write more. Also, comment below if you face any issues with following this article or getting it working. I will try my best to help you resolve the problem. The Java Helps community is also willing to help each other and grow together.

Share.
Exit mobile version