Accepted answer

With the Scala plugin installed either

  • A. Create a new project and select the Scala facet in the creation phase. It will create the Scala library lib and Scala compiler lib and setup the facet for you

  • B. If you already have a project. Go to Project Structure -> Modules and right click the module and go Add facet and add a Scala facet. Now you need to add scala-library.jar as a library of the module and go into the Scala facet and point it to a library containing scala-compiler.jar

Some more information

enter image description here

this is what your module should look like under project settings

enter image description here

select the Scala facet and this is what you should see (Library name for the compiler is unimportant as long as it says (version xxx) next to the library name

enter image description here

these are the jar files in my scala-compiler lib

enter image description here

and these are the jar files in my scala-library lib

With everything setup like that you should be able to right click -> new Scala class (Select object from the dropdown) in a source directory and add

def main(args:Array[String]) {
   println("Hello world")

then right click on the class and select Run Classnam.main() and IntelliJ will setup a run configuration for you.


Use sbt with sbt-idea plugin to generate idea project files for complex projects.


For simple projects.

Add scala nature to the project, and you can right click and run any file extending App.


A good walk-through on how to set up a Scala project in Intellij is located here:


Edit: I can see someone posted somewhat the same I want to say here. I hope this can give a few more in-depths hints, so I will post it anyway :-)

If you would like to run Scala native in IntelliJ (I shifted to IntelliJ and still can't get my hands down) you need to make sure a few things are in order. Most of this happens under File -> Project Structure which requires you to create a project (when you get a hang of it, it is much more logical than Eclipse -- and Netbeans for that matter). I am also assuming you have selected a jdk, but this can also be done in the Project Structure.

Now, to Scala:

  1. Make sure you have the Scala plugin. Visit the Settings (File -> Settings; can also be found at the start-up screen) and locate 'Plugins' (for me it's nr. 8 from the bottom). Under "Browse Repositories" you should be able to search for "scala", find and install a plugin. 1 A. If no plugins pops up you are probably using a version of intellij where scala is not (yet) supported. If that happens you can go to the homepage for the plugin and download the nightly build.
  2. Import Scala as a library in File -> Project Structure -> Global Libraries. Click the plus sign, select Java (Scala is a Java-lib), browse to your scala-dir (which can be downloaded here: and select the lib directory. Press ok and you should see the library popping up on the list.
  3. Make sure the facet (Scala framework) is in place. Goto File -> Project Structure -> Facets. Click on the plus-sign and find Scala. A sublink should appear (if not double-click the Scala link). Clicking the sublink make sure you have selected a compiler before continuing. This should be provided by the modules selected before. I normally use FSC (Fast Scala Compiler) but it's probably a good idea to test the basic settings before experimenting.
  4. Make sure the Scala Module is in place. In Project Structure -> Modules click on the module you want to compile in scala and click the plus icon above and select Scala. Again be sure to select a compiler library.
  5. If you want to, setup configurations for the compiler under the facet

Related Query

More Query from same tag