你好,我正在twitter API twitter4j工作。我想通過我的Java代碼來發送Twitt在我的Twitter賬戶,但是當我嘗試編譯它,我得到了一些錯誤,我不明白 我的Java代碼Twitter與Java代碼整合的錯誤?
public class entry {
public static void main(String ar[])throws TwitterException, IOException
{
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true);
cb.setOAuthConsumerKey("dJGC64ozxFNfs7D3LK07oA");
cb.setOAuthConsumerSecret("ExvnfE8AOM5vjqdjANoRdZyLKSOo2LZyHnxo2ERWzOs");
cb .setOAuthAccessToken("*****************************");
cb.setOAuthAccessTokenSecret("**************************");
Twitter tf=new TwitterFactory(cb.build()).getInstance();
tf.updateStatus("test ! ");
}
}
錯誤,我正在歌廳當我嘗試編譯我的代碼:
Exception in thread "main" A JSONObject text must begin with '{' found:
at 2 [character 3 line 1]
Relevant discussions can be found on the Internet at:
http://www.google.co.jp/search?q=6f994c35 or
TwitterException{exceptionCode=[6f994c35-006e990b 1b2aeabf-9f2c6cb7], statusCode=-1, message=null, code=-1, retryAfter=-1, rateLimitStatus=null, version=3.0.3}
at twitter4j.internal.http.HttpResponse.asJSONObject(HttpResponse.java:153)
at twitter4j.internal.json.StatusJSONImpl.<init>(StatusJSONImpl.java:66)
at twitter4j.internal.json.z_T4JInternalJSONImplFactory.createStatus(z_T4JInternalJSONImplFactory.java:69)
at twitter4j.TwitterImpl.updateStatus(TwitterImpl.java:241)
at twiterapplication.entry.main(entry.java:29)
Caused by: twitter4j.internal.org.json.JSONException: A JSONObject text must begin with '{' found:
http://www.google.co.jp/search?q=006e990b
這是'entry.java'的第29行嗎? (提示:類名應以「Entry」的大寫字母開頭。) – 2013-07-01 12:46:45
第29行的代碼tf.updateStatus(「test!」); – Simmant
有沒有解決方案先生 – Simmant