1

The tutorial code from

http://doc.akka.io/docs/akka/2.0.2/intro/getting-started-first-java.html

Will not run. I have imported the required libraries but get the error:

Exception in thread "main" java.lang.NoClassDefFoundError: com/typesafe/config/ConfigFactory
    at akka.actor.ActorSystem$.apply(ActorSystem.scala:93)
    at akka.actor.ActorSystem$.create(ActorSystem.scala:56)
    at akka.actor.ActorSystem.create(ActorSystem.scala)
    at Pi.calculate(Pi.java:152)
    at Pi.main(Pi.java:15)
Caused by: java.lang.ClassNotFoundException: com.typesafe.config.ConfigFactory
    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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    ... 5 more

Anyone know how to get this working? I'm trying to run it in Eclipse.

Note: I'm running akka 2.1.2

4

1 回答 1

1

The problem is that you are not actually using Akka 2.0.2: the Config library only became an external dependency in 2.0.3. Since you are getting started with Akka, may I suggest you look at the latest stable version 2.1.2 instead?

Concerning the problem at hand: you will need to add the artifact "com.typesafe"/"config" to your classpath (the exact version depends on which Akka version you are using, I suggest using a dependency management tool like Maven or SBT).

Here's a link to the documentation (including required Scala versions etc) for each major version of Akka: http://akka.io/docs/

于 2013-05-11T17:59:53.573 回答