java.lang.NoClassDefFoundError: akka/actor/UntypedActorFactory error when trying to run jar created using gradle build

I get the following error whe I try to run the jar built using gradle. Help is highly appreciated (I get the same errror if run another project)

C:\gradle-eclipse\pi\build\libs>java -jar pi-1.0.jar Exception in thread “main” java.lang.NoClassDefFoundError: akka/actor/UntypedActorFactory

at java.lang.Class.getDeclaredMethods0(Native Method)

at java.lang.Class.privateGetDeclaredMethods(Unknown Source)

at java.lang.Class.getMethod0(Unknown Source)

at java.lang.Class.getMethod(Unknown Source)

at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)

at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) Caused by: java.lang.ClassNotFoundException: akka.actor.UntypedActorFactory

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 sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

Usually running

java -jar pi-1.0.jar

isn’t enough to run your application as an application usually depends on thirdparty libraries (in your case the akka library)

If you look for a convenent way to generate an application with gradle, you should look at the application plugin (http://www.gradle.org/docs/current/userguide/application_plugin.html). Among other things, this plugin provides a “run” task to actually run your app via gradle.

cheers, René