我正在尝试导入httpclient,字符串实体类和提到的所有其他类,但没有任何一个类被导入。我已将jar文件添加到生成路径,但似乎没有任何方法可以解决错误。有人可以帮我解决这个问题吗?我已经坚持了将近一天。
package httpRequests;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
public class http {
public static void main(String[] args) {
// TODO Auto-generated method stub
String IP = "api.cle.org.pk";
String postURL = "https://" + IP+ "/v1/synth";
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost post = new HttpPost(postURL);
StringEntity postingString = new StringEntity(JSON_MSG,"UTF-8");
post.setEntity(postingString);
post.setHeader("Content-type", "application/json;odata=verbose");
HttpResponse response = httpClient.execute(post);
String JSON_Response=convertStreamToString(response.getEntity().getContent());
}
}