Reputation: 196
I am having trouble running Scala on Intellij Idea.
I have a Scala Object (basic HelloWorld
), but I am unable to run it (the run button is grayed out).
I know I need to add a configuration before running, but which one should I choose? Intellij Idea offers templates like ScalaTest and Scala REPL, but I have no knowledge on the differences of these or what options I should set on them, or if should use either of them. I couldn't find tutorials on this either.
Upvotes: 2
Views: 361
Reputation: 2178
You can add Scala under your existing project as following.
Under project set up (command + ;) -> global libraries -> + -> Scala SDK
Upvotes: 0
Reputation: 48400
Personally I setup a quick hello world app in IntelliJ in the following manner
sbt new scala/scala-seed.g8
to get the correct project structureFile | Open
Import Project from sbt
settings I select Use sbt shell
for both imports
and builds
, so I get the same build behaviour in IntelliJ and system terminal.Hello.scala
and Run 'Hello'
to automatically setup run configuration.Upvotes: 1
Reputation: 14803
The simplest way is maybe to create a new Project and then copy your code.
Files > New > Project..
sbt
Copy your files in yourProject/src/main/scala
Now your HelloWorld should like this:
Upvotes: 2