[英]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. 在线上的大多数资源都告诉我添加了Maven依赖项,但是一旦将其下载到项目中后,我还没有找到有关如何使用Jackson罐子文件的有效描述。
I'm a beginner in Java. 我是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? 如何将导入内容写入Java文件以使用此位置的jar文件?
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. 按照上述步骤操作,右键单击您的项目->属性-> Java构建路径->库->添加外部Jar->选择您最近下载的jackson-core-2.8.7.jar,即它。
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. 现在转到需要任何类的jackson库的Java类,并从需要使用/扩展的库中导入该类。 Refer screenshot attached below for further reference. 请参考下面所附的屏幕截图,以获取更多参考。
The question was answered in the Answer comments by @shmosel @shmosel在“答案”评论中回答了该问题
import com.fasterxml.jackson.core.JsonParser; 导入com.fasterxml.jackson.core.JsonParser;
The answer by @Pratik Ambani is very useful too. @Pratik Ambani的回答也非常有用。
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/ 可以在以下位置找到文件: http : //repo1.maven.org/maven2/com/fasterxml/jackson/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.