1

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?

NewForOlly
  • 35
  • 5
  • 2
    Looks like you are not using a modular project (no module-info.java) so the jars should in the Classpath section, not the Modulepath. – greg-449 Jul 23 '21 at 13:57
  • Thank you ever so much for your reply! it has solved my problem and allowed me to research further into project types. – NewForOlly Jul 23 '21 at 16:29

0 Answers0