I have an absolutely basic Scala project done in IDEA. The folder structure is only .idea , src and projectName.iml . Inside src I have only one file named Main.scala . The contents of this file are:
object Main extends App { println("Hello, World") }
I am trying to just run this code from inside IDEA. In Eclipse / Java, you could just right-click the main class file and click "Run as ... Java Application".
Apparently, IDEA does not automatically recognize Main.scala as an executable file, so the context menu does not contain such an option. There is only the Run Scala Console , which is absolutely not what I need and does not even work properly (this says type :help to see more , but entering it only emphasizes the text as an error). Looking around at Google, I found that you can do the following:
- go to the main context menu of the
Run program, select Edit Configurations - click the
+ button to add a new configuration, select Application as the base - select the main launch configuration class, enter any other material if you need it, then save the configuration
And here the problem lies. I can not select the main class. When I click the browse button next to the Main class: input field, select the Project tab, go to src/Main and click OK , a warning window will appear with the text Main is not acceptable .
This error message gives me absolutely no information about why this is unacceptable, which is especially annoying because the same project structure will work with Java projects.
Does anyone know how to do this?
PS IDEA version 13.1.3, Scala version 2.11.1.
source share