I have a scala app with an object which implements def main(args:Array[String]): Unit trait. I use the sbtAssembly plugin to create a fat jar, and I can run it from the console using:
scala myjar.jar
However, I want to hand this over to colleagues who don't have scala installed, but only the jdk/jre. So I tried to run this with java, however it fails:
java -jar myjar.jar
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: scala/collection/Seq
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: scala.collection.Seq
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
What do I have to do in order to be able to run it with java? Is this even possible?
scala/collection/Seq.classis in your fat jar?includeScala = false. After changing totrue, I was able to run it usingjava -jar myjar.jar. If you add this hint as answer, I can accept it.