Mashape Unirest Java : java.lang.NoClassDefFoundError

大憨熊 提交于 2019-12-23 05:26:12

问题


I'm building an application using Mashape's Unirest library(unirest-java-1.2.6.jar) . I'm getting NoClassDefFoundError during runtime. I tried CommonsWare's method. But it didn't work. Here is the screenshot of Java Build Path. Anything wrong in this screenshot??


回答1:


I'm the author of Unirest-Java.

In order to use the library, you need to include the required dependencies into your project:

  • Apache HttpComponents Client
  • Apache HttpComponents AsyncClient
  • Apache HttpComponents Mime
  • JSON library

Using Maven is the preferred method: https://github.com/Mashape/unirest-java#installing

Otherwise the libraries can be manually downloaded from http://hc.apache.org/downloads.cgi and http://www.json.org/java/index.html

But again, I would strongly recommend to use Maven. Also please update the Unirest library to the newest version because 1.2.6 is deprecated now.




回答2:


It's advisable to package everything in one uber jar by using Maven.

Please refer to this post on how to use Unirest in your Java projects.



来源:https://stackoverflow.com/questions/19562984/mashape-unirest-java-java-lang-noclassdeffounderror

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!