This is somehow a follow-up of this question.
When I'm creating a Scala package with sbt, I am able to run it using one of these ways:
simply by typing
run
in the sbt consoleor by creating a jar file (using either
one-jar
orassembly
), and the running this jar in the system console by typingjava -jar myjar.jar
But I don't know how to
run my package from the scala program ? (not the sbt scala console, in which everything works fine by typing
import mypackage._
)use my Scala package in another project ? for example by importing
myjar
in another project ?
EDIT : you can forget my questions below about sbt-start-script
because now I'm using sbt-native-packager
(I have tried it just now and it works, but my previous questions remain open).
I have tried to use sbt-start-script but unsucessfully. The target/start
script is well created but I get such errors:
$ sh target/start
target/start: 2: target/start: Bad substitution
Exception in thread "main" java.lang.NoClassDefFoundError: Hi
Caused by: java.lang.ClassNotFoundException: Hi
...
Here I simply have a main.scala
file in the src/main/scala
folder and it is:
object Hi { def main(args: Array[String]) = println("Hi!") }
I'm using these settings in build.sbt
:
import com.typesafe.sbt.SbtStartScript
seq(SbtStartScript.startScriptForClassesSettings: _*)