1

I had a simple sbt project and I ran sbt package to generate a jar file. However, it seems my java runtime cannot find the default scala library. May I know how I can fix this issue ?

FYI, if I run with scala client_2.12-0.1.0-SNAPSHOT.jar everything works fine.

Thanks!

enter image description here

enter image description here

enter image description here

David
  • 241
  • 2
  • 11

2 Answers2

2

You can use sbt-assembly or sbt-pack to create the complete package including dependencies. See their readmes and What are key differences between sbt-pack and sbt-assembly?.

Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487
1

You need to specify Scala Library jar and other dependency jars when you run the sbt built jar with java

you can refer below link for more details

https://alvinalexander.com/scala/how-to-run-scala-sbt-packaged-jar-file-with-java-command

arjunsv3691
  • 791
  • 6
  • 19