title: Java -jar command fails with an error "main" java.lang.NoClassDefFoundError
body: <p>Hi I'm building an application in which we use Akka and Scala. When I use IntelliJ IDE to clean and install my application there are no errors produced for the build. Our next step is to use Jenkins Looper to deploy it on cloud, and that was failing. When that happened we attemtped to debug the issue using java -jar command on the jar file that is produced by the code. When we do that a stack trace error is produced as follows:</p>
  
  <pre><code> Exception in thread "main" java.lang.NoClassDefFoundError: akka/http/scaladsl/server/Directive
  
          at java.lang.Class.getDeclaredMethods0(Native Method)
  
          at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
  
          at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
  
          at java.lang.Class.getMethod0(Class.java:3018)
  
          at java.lang.Class.getMethod(Class.java:1784)
  
          at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
  
          at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
  Caused by: java.lang.ClassNotFoundException: akka.http.scaladsl.server.Directive
  
          at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
  
          at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
  
          at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
  
          at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  
          ... 7 more
  </code></pre>
  
  <p>Can someone help me debug that error? I see that the caused by shows it's unable to find akka.http.scaladsl.server.Directive, but I cannot determine what that Exception with "main" is and what to do about it.</p>