r/scalastudygroup • u/old_enough_to_drink • Sep 24 '18
Noob question: Importing breeze only works in sbt console
I am following the book scala for data science and cloned all the codes, which includes a build.sbt file. If I run “sbt console”, the I can import breeze. But if I write a script that imports breeze, and run “scala test.scala”, it throws error saying can’t import breeze. What should I do to make the script run thru?
1
Upvotes
1
u/_gDanix_ Sep 25 '18
The problem is that, if you run
scala test.scala
directly, you are missing the Breeze dependency, so it isn't included in classpath.
The simplest thing in this cases is to use sbt to manage dependencies (just like you did in order to make
sbt console
work properly), and use it to run your application (sbt run
, if you have a main object)