By   September 1, 2018

IntelliJ & Scala – Could not load main class

This is one of the most common error we see when we get new code from a source repository. We might also see it when we create a new Scala project. As we run the application, the console shows could not load main class

Could not load Main class

Could not load Main class

The solution is simple. Just open module setting and see if the source folder for code has been correctly specified for the module which is being used to run the application.

source folder in module

source folder in module

Just make sure that the same module is selected in your debug configuration in Use class path of module option.

classpath of module

classpath of module