Class StringSerializer.class could not be found

Hello community,

I would like to ask the question from the Running Command issue gradlew for producer & consumer issue, as there’s no solution mentioned and the issue is closed.

In my case the issue is exactly the same as the one mentioned above, with the only exception that I run the build on Amazon Linux 2023 machine.

@aaditya2000, could you share your solution?

Any help with actual solution would be highly appreciated.
Thanks

Without seeing your Gradle file, it’ll be difficult to help much, but similar to Maven, your jar may not have the necessary classpath or dependencies included (i.e kafka-clients)

Please try using gradle shadow plugin to create a shaded fat jar, then run that with Java, not gradlew