从jar执行scala代码,需要澄清

时间:2015-04-27 19:48:35

标签: java scala maven

我有一个maven项目,最后生成1个jar文件。项目包含2个模块,其中一个是Java,另一个是Scala。

Scala模块将Java代码用于某些后端事务。在我的例子中,Java是实际逻辑,Scala是业务规则。

这就是我执行代码的方式。无论如何我都在尝试工作

抛出java.lang.ClassNotFoundException:

scala -cp /usr/share/scala/lib/scalatest_2.11-2.2.4.jar org.scalatest.tools.Runner -p '/home/program-201504.22-SNAPSHOT.jar:/home/me/git/program/scala/target/scala-program-201504.22-SNAPSHOT.jar:/home/me/temp/lib/.' -o -fWDF /home/me/git/program/scala/target/surefire-reports/TestSuite.txt -u /home/me/git/program/scala/target/surefire-reports/. -s a.b.engine.driver.MyClass

抛出java.lang.ClassNotFoundException:

scala -cp /usr/share/scala/lib/scalatest_2.11-2.2.4.jar:/home/program-201504.22-SNAPSHOT.jar:/home/me/temp/lib/.:/home/me/git/program/scala/target/scala-program-201504.22-SNAPSHOT.jar org.scalatest.tools.Runner -p '/usr/share/scala/lib/scalatest_2.11-2.2.4.jar:/home/program-201504.22-SNAPSHOT.jar:/home/me/temp/lib/.:/home/me/git/program/scala/target/scala-program-201504.22-SNAPSHOT.jar' -o -fWDF /home/me/git/program/scala/target/surefire-reports/TestSuite.txt -u /home/me/git/program/scala/target/surefire-reports/. -s a.b.engine.driver.MyClass

java.lang.NoClassDefFoundError

scala -cp /usr/share/scala/lib/scalatest_2.11-2.2.4.jar org.scalatest.tools.Runner -R "/home/program-201504.22-SNAPSHOT.jar /home/me/git/program/scala/target/scala-program-201504.22-SNAPSHOT.jar /home/me/temp/lib/." -o -fWDF /home/me/git/program/scala/target/surefire-reports/TestSuite.txt -u /home/me/git/program/scala/target/surefire-reports/. -s a.b.engine.driver.MyClass

请帮助我理解我做错了什么。

  1. 我确认a.b.engine.driver.MyClass存在于/home/me/git/program/scala/target/scala-program-201504.22-SNAPSHOT.jar

0 个答案:

没有答案