线程“ main”中的异常java.lang.NoClassDefFoundError:org / apache / http / concurrent / FutureCallback 在com.mashape.unirest.request.BaseRequest.asJson(BaseRequest.java:68) 在iezon.main.WebSocket.getAllApps(WebSocket.java:21) 在iezon.main.Init(Init.java:16) 在iezon.main.Init.main(Init.java:27) 引起原因:java.lang.ClassNotFoundException:org.apache.http.concurrent.FutureCallback 在java.net.URLClassLoader.findClass(未知来源) 在java.lang.ClassLoader.loadClass(未知来源) 在sun.misc.Launcher $ AppClassLoader.loadClass(未知来源) 在java.lang.ClassLoader.loadClass(未知来源) ...还有4个
我当前的代码是:
package iezon.main;
import org.json.JSONArray;
import org.json.JSONObject;
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.JsonNode;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
import iezon.interfaces.options.InterfaceController;
public class WebSocket {
public WebSocket() {
}
public void getAllApps() {
try {
HttpResponse<JsonNode> request = Unirest.get("https://iezontechnologywebapp.000webhostapp.com/api/store/get").asJson();
JSONArray response = request.getBody().getArray();
for (int i = 0; i < response.length(); i++) {
JSONObject object = response.getJSONObject(i);
// TODO: Load apps properly this is just a test dialog to show they loaded
InterfaceController.showDialog(new Object[] {
object.getString("name"),
object.getString("description")
}, "Apps loaded");
}
} catch (UnirestException e) {
e.printStackTrace();
}
}
}
我尝试将httpclient-4.3.3.jar和commons-io-2.5.jar添加到构建路径中,但都没有解决该问题,我检查了文档,但没有说我需要任何其他库来运行太空战士