问题
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