NewForOlly
NewForOlly

Reputation: 45

NoClassDefFoundError even though jar is in the module path Eclipse

I am working on a vanilla Eclipse project and trying to avoid using Maven.

I have added Jackson modules to the module path as an external jar. When I do so, the import statement no longer shows an error but when I run my program I get the following error

Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper at bitcoin.PriceConverter.getJsonFromUrl(PriceConverter.java:48) at bitcoin.PriceConverter.main(PriceConverter.java:26) Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 2 more

Line 48 in PriceConverter is ObjectMapper objMapper = new ObjectMapper();

modulepath

I have googled extensively and found that my classpath is potentially broken however, all of the answers are from outdated versions of Eclipse and I cannot work out how to fix this problem.

I tried the same thing with Gson and had the same problem however, yesterday I added the json-20210307.jar and it worked fine.

Can anyone explain what is happening here and guide me on how to fix it?

Upvotes: 1

Views: 857

Answers (0)

Related Questions