我有一个独立的 OAuth2.0 java 程序。我在用
DefaultHttpClient client = new DefaultHttpClient()
在我的代码中,我将外部 Jar httpClient jar 添加到我引用的库中。但是当我运行我的课程时,它显示以下错误:
引起:java.lang.ClassNotFoundException: org.slf4j.LoggerFactory at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher $AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 还有 8 个
public class OAuth {
public static void main(String[] args) {
String resourceURL = "google.com";
HttpPost post = new HttpPost(resourceURL);
DefaultHttpClient client = new DefaultHttpClient();
HttpResponse response = null;
try {
response = client.execute(post);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally { post.releaseConnection();
}
---print something
}
}