Home > Back-end >  Scala Worksheet in IntelliJ gives "no module classpath specified"
Scala Worksheet in IntelliJ gives "no module classpath specified"

Time:06-29

I am setting up a project with the following structure:

project
project/frontend: HTML and Javascript stuff
project/backend: Scala - this contains build.sbt

I believe the folder structure is the problem. When I have a project without these sub-folders, IntelliJ works well. Now that I have these sub-folders (and open Intellij in the project super-folder), any run of a Scala worksheet gives me the error of "No module classpath specified". Would you have suggestions for fixing this? I simply don't know what to do to specify a classpath.

IntelliJ version: 2022.1.2, Build #IU-221.5787.30

See Worksheet settings:enter image description here

CodePudding user response:

This was resolved by adjusting the content root for modules:

  1. Click on "File"->"Project Structure"
  2. In the Project Structure Modal, click on "Project Settings"->"Modules"
  3. Adjust the content root, setting it to "backend" (you might have to remove the default content root to do that).

This also fixes a bunch of other issues, e.g. the IDE detecting and linking objects correctly.

enter image description here

enter image description here

enter image description here

  • Related