Fixing sbt error: java.lang.RuntimeException: No main class detected.

If you set up a scala project and try to build with sbt, you can get this error:

java.lang.RuntimeException: No main class detected.

This is caused by setting up the project incorrectly, like so:
Intellij Project

To fix this, move your main class into src/main/scala (this structure comes from the standard maven project structure):

Intellij Idea: correct project structure for a scala project

Leave a Reply

Your email address will not be published. Required fields are marked *