Menu Close

How do I run a Scala file in IntelliJ?

How do I run a Scala file in IntelliJ?

Run a Scala application via Intellij IDEA

  1. Create or import a Scala project as you would normally create or import any other project in IntelliJ IDEA.
  2. Open your application in the editor.
  3. Press Shift+F10 to execute the application. Alternatively, in the left gutter of the editor, click the. icon and select Run ‘name’.

How do I run a Scala worksheet?

You can quickly evaluate and run Scala code using either a Scala worksheet or Ammonite….Run Scala code using Scala worksheet

  1. Create a Scala worksheet file and open it in the editor.
  2. Add your code.
  3. Click.

What is a Scala worksheet?

A worksheet is a Scala file that is evaluated on save, and the result of each expression is shown in a column to the right of your program. Worksheets are like a REPL session on steroids, and enjoy 1st class editor support: completion, hyperlinking, interactive errors-as-you-type, auto-format, etc.

How do I run a module in IntelliJ?

You can run applications right from IntelliJ IDEA if you have an SDK set up for your project/ module….Customizable way

  1. Click. in the gutter near the class declaration and select Modify Run Configuration.
  2. Modify the run/debug configuration as needed.
  3. Click.

How do I know my Scala version?

  1. The first one is nicest of all on this page, seemingly 🙂 – mlvljr Nov 23 ’14 at 7:30.
  2. FYI util.Properties.versionNumberString only exist since scala 2.10.x. For scala below 2.10.x, you can use util.Properties.releaseVersion.getOrElse(“unknown version”) to get version number string. – jordom Feb 28 ’15 at 20:38.

How do I run a Scala command line?

To run Scala from the command-line, simply download the binaries and unpack the archive. Start the Scala interpreter (aka the “REPL”) by launching scala from where it was unarchived. Start the Scala compiler by launching scalac from where it was unarchived.

What is REPL in Scala?

The Scala REPL is a tool (scala) for evaluating expressions in Scala. In interactive mode, the REPL reads expressions at the prompt, wraps them in an executable template, and then compiles and executes the result. Previous results are automatically imported into the scope of the current expression as required.

What is Scala worksheet in IntelliJ?

Intellij IDEA lets you create a Scala worksheet that enables you to evaluate your Scala code results in a special view of the Scala editor.

What is an IntelliJ module?

In IntelliJ IDEA, a module is an essential part of any project – it’s created automatically together with a project. Projects can contain multiple modules – you can add new modules, group them, and unload the modules you don’t need at the moment.

How do I change IntelliJ module settings?

Configure module language level

  1. From the main menu, select File | Project Structure Ctrl+Alt+Shift+S .
  2. Under Project Settings, select Modules | Sources.
  3. From the Language level list, select the necessary option.
  4. To use the project language level, select Project default.

How to evaluate and run Scala code in IntelliJ IDEA?

You can quickly evaluate and run Scala code using either a Scala worksheet or Ammonite. Since in IntelliJ IDEA Scala worksheet and Ammonite files have the same file extension .sc, you need to let IntelliJ IDEA know how to treat such files in your project. In the Settings/Preferences dialog Ctrl+Alt+S, go to Languages & Frameworks | Scala.

How to run, debug and test Scala applications?

IntelliJ IDEA lets you run, debug and test your Scala applications as you would normally do with any other applications in IntelliJ IDEA. IntelliJ IDEA also lets you run your Scala code with coverage and configure code coverage settings.

How do I create a worksheet in Scala?

Open a Scala worksheet file in the editor. Click on the toolbar of the worksheet editor to open the Worksheet settings dialog. In the Worksheet settings dialog, configure the current worksheet settings or the default worksheet settings for the whole project that will affect other worksheets.

How to run debug and test in IntelliJ IDEA?

Open the test in the editor, press Ctrl+Shift+F10 or right-click on the test class and from the context menu select Run ‘test name’. IntelliJ IDEA creates a run/debug configuration for the test automatically, but if you want to edit settings in your configuration, click Run | Edit Configurations on the main menu.