I am trying to package a simple executable Jar written in Scala, through Eclipse's Export function.
When attempting to execute the Jar from cmd java -jar test2.jar
I get the following error. Any ideas? Thank you.
Caused by: java.lang.NoClassDefFoundError: scala/Predef$
at Parser.Test(Parser.scala:5)
at Main.main(Main.java:12)
... 5 more
Caused by: java.lang.ClassNotFoundException: scala.Predef$
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more
You just need to add the scala library jar to the classpath.
You can do it like this (assuming that the "scala-library.jar" jar is in the current directory) :
java -cp scala-library.jar -jar test2.jar
The documentation for tha java
comamnd can be found here: http://docs.oracle.com/javase/6/docs/technotes/tools/windows/java.html