object SimpleAkkaTest { def main(args: Array[String]) { val system = ActorSystem.create("system") val work =system.actorOf(Props[Worker],"worker-1") work ! 1 } } class Worker extends Actor { override def receive = { case 1=> println("1") case _ => println("_") } }
Exception in thread "main" java.lang.ClassNotFoundException: akka.simpleAkka.SimpleAkkaTest
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)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:116)
解决方案:项目->open module setting->Modules->Dependencies 加上scala sdk的library