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

(glorious_hameedi) #1

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:

at$ Source)

at$ Source)

at Method)

at Source)

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

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

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

(René Groeschke) #2

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 ( Among other things, this plugin provides a “run” task to actually run your app via gradle.

cheers, René