APP Key:
177697xxxxx
APPSecret:
5620f6106xxxxxaf9dd456e41axxxxxx
package steven.weibo;
import javax.swing.JFrame;
import weibo4j.Status;
import weibo4j.Weibo;
public class UpdateWeibo extends JFrame {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("weibo4j.oauth.consumerKey", Weibo.CONSUMER_KEY);
System.setProperty("weibo4j.oauth.consumerSecret", Weibo.CONSUMER_SECRET);
try {
Weibo weibo = getWeibo(true,args);
Status status = weibo.updateStatus("测试发送微博");
System.out.println(status.getId() + " : "+ status.getText()+" "+status.getCreatedAt());
} catch (Exception e) {
e.printStackTrace();
}
}
private static Weibo getWeibo(boolean isOauth,String ... args) {
System.out.println("1");
Weibo weibo = new Weibo();
System.out.println("2");
if(isOauth) {//oauth验证方式 args[0]:访问的token;args[1]:访问的密匙
weibo.setToken("177697xxxxx", "5620f6106xxxxxaf9dd456e41axxxxxx");
}else {//用户登录方式
weibo.setUserId("fanjiaxing@hotmail.com");//用户名/ID
weibo.setPassword("xxxxxxxx");//密码
}
return weibo;
}
}
1
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/httpclient/methods/RequestEntity
at weibo4j.WeiboSupport.<init>(WeiboSupport.java:35)
at weibo4j.WeiboSupport.<init>(WeiboSupport.java:40)
at weibo4j.Weibo.<init>(Weibo.java:2430)
at steven.weibo.UpdateWeibo.getWeibo(UpdateWeibo.java:28)
at steven.weibo.UpdateWeibo.main(UpdateWeibo.java:18)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.httpclient.methods.RequestEntity
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 5 more
请问在
System.out.println("1");
Weibo weibo = new Weibo();为什么报错,求懂的人指点一下!
在线等!