简体   繁体   中英

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?

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:

在此处输入图片说明

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

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.

在此处输入图片说明

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM