user_123945839432
user_123945839432

Reputation: 189

SBT asking for a command

So I am trying to run sbt on my linux VM. I downloaded sbt, and I added a plugin from my current cs class.

I created a directory with a src/main/scala folder in it.

I also wrote a script and saved it on the scala file.

However, every time I try to run sbt on my terminal, I get two lines:

[info] Loading global plugins from /home/student/.sbt/0.13/plugins
[info] set current project to student (in build file:/home/student/)
>

It asks for a command when it should not. I have tried 'test', 'run', and nothing works. And I am inside the directory which has the structure necessary.

My goal is to get to sbt console so I can scala.

Upvotes: 1

Views: 71

Answers (1)

Johnny Everson
Johnny Everson

Reputation: 8601

In order to execute a Scala script, that is, using Scala as scripting language, you don't need SBT (assuming you also have installed scala). You can invoke your script directly as follows:

shell> scala myscript.scala where myscript.scala may contain:

println("hello world!")

The SBT use case and the above project structure is needed when you have a Scala application, that is, at least an object with a main(args: Array[String]) method. e.g.

object HelloWorld {
    def main(args: Array[String]) {
      println("Hello, world!")
    }
  }

You can find more details about how to get started on Scala official site

Upvotes: 2

Related Questions