How do I import jackson classes into a Java file if I've downloaded the jar file into my project and included it into my Build Path?

10,446

Solution 1

What I understood by your post is that you are not able to access any class of a library you've imported into your workspace.

Follow mentioned steps, Right click on your project --> Properties --> Java Build Path --> Libraries --> Add External Jar --> Choose jackson-core-2.8.7.jar which you've recently downloaded and that's it.

Now go to your Java Class where you need any class of jackson library and import the class from the library you need to use/extend. Refer screenshot attached below for further reference.

enter image description here

Solution 2

The question was answered in the Answer comments by @shmosel

import com.fasterxml.jackson.core.JsonParser;

The answer by @Pratik Ambani is very useful too.

Also, not just the jackson core has to be imported but also databind and annotations.

The files can be found here: http://repo1.maven.org/maven2/com/fasterxml/jackson/

Share:
10,446
sevku
Author by

sevku

Updated on June 05, 2022

Comments

  • sevku
    sevku almost 2 years

    Most resources online tell me add the Maven dependencies, but I haven't found a working description on how I use the Jackson jar file once I've downloaded it into my project.

    I'm a beginner in Java. Thank you for your help.

    As simple as possible:

    enter image description here

    How to write an import into a java file to use the jar file from this location?