我有一个带有 RemoteActors 的小应用程序,我想从中制作一个 jar 文件。当我尝试执行它时,会出现以下异常:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.NoClassDefFoundError: scala/actors/Combinators
at pingpong.PingApp$.main(PingApp.scala:5)
at pingpong.PingApp.main(PingApp.scala)
at pingpong.ScalaEntryPoint.main(ScalaEntryPoint.java:5)
... 5 more
Caused by: java.lang.ClassNotFoundException: scala.actors.Combinators
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 8 more
我在我的 jar 文件中包含了 scala-library.jar,它位于类路径中。否则 java 将停止寻找类ScalaObject
。