0

Apologies as this is likely a dumb question but I am new to Scala.

Trying to run the following project from the command line

https://github.com/falconair/ComposingContracts

But getting the following

justin@justin-ThinkPad-X240:~/work/ComposingContracts$ scala src/main/scala/Main.scala 
/home/justin/work/ComposingContracts/src/main/scala/Main.scala:5: error: not found: value ComposingContracts
import ComposingContracts._
       ^
one error found
justin@justin-ThinkPad-X240:~/work/ComposingContracts$ 

The structure of the code looks like I should be able to run it from the command line. This looks to me like it's probably some kind of classpath error. But I don't know enough Scala to be sure.

Thanks in advance.

1
  • You have to use the build tool sbt to build and run that code. Commented May 26, 2016 at 12:12

2 Answers 2

2

As said by Jesper, you have to use sbt to run this code :

  1. Install sbt (here)
  2. Go to the folder where is located the build.sbt file
  3. Run the following command : sbt run

More information about sbt commands can be found here

EDIT : as mentionned in the comments, you can use sbt console

sbt console starts the Scala interpreter with a classpath including the compiled sources, all jars in the lib directory, and managed libraries.

Sign up to request clarification or add additional context in comments.

1 Comment

And if you need to play with your project, sbt console is more suited to the job than sbt run
0

According to there is build.sbt file on the root of the project you should use sbt to run the program. For this simply use the following command from the project root directory:

sbt run

The command will compile the project properly and execute the Main.scala.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.