NoClassDefFoundError – missing dependencies in the classpath

My problem

I have written some java-code. The code runs flawlessly in intellij.
But when I run it as a .jar file (i.e., the command java -jar app.jar), I get the error message:
Unable to initialize main class RSocketClient.Client
Caused by: java.lang.NoClassDefFoundError: io/rsocket/transport/ClientTransport

My Research

I have been searching about the NoClassDefFoundError on google and stackoverflow and have found that the error arises when dependencies are missing. The solution seems to be that I need to add dependencies to the classpath or maven repository. But I don’t know how to do this (my pom.xml is presented below).

My Question

All I want to do is to turn my program into a .jar file and run it through my terminal (Windows10 OS). I appreciate all the help that I can get.


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=""


                <!-- Build an executable JAR -->





It looks like your jar doesn’t contain classes of RSocket itself, and its fine. Jar created by maven contains only your classes (in your module).

The jar of rsocket (as well as other jars that you’re using,like SLF4J stuff for example) reside in the corresponding jars prepared by the maintainers of these third-parties.

IntelliJ “sees” the whole classpath (that includes all the dependencies) and runs your application with all this classpath.

Probably what you should do is create a jar including dependencies: See This SO thread

Another option is keeping your jar “as is” but requiring that it will be run with all the dependencies in the classpath, but it looks like its not what you’re trying to do, this way is used when you’re developing a library and not a standalone application.

Source: stackoverflow