我使用twitter4j 4.0.2twitter4j 4.0.2 java.lang.NoClassDefFoundError:COM/squareup/okhttp/OkHttpClient
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setOAuthConsumerKey(this.consumerKey);
cb.setOAuthConsumerSecret(this.consumerSecret);
cb.setOAuthAccessToken(this.accessToken);
cb.setOAuthAccessTokenSecret(this.accessTokenSecret);
this.twitter = new TwitterFactory(cb.build()).getInstance();
在這裏,我得到的錯誤,當我運行這個
Exception in thread "main" java.lang.NoClassDefFoundError: com/squareup/okhttp/OkHttpClient
at twitter4j.AlternativeHttpClientImpl.prepareClient(AlternativeHttpClientImpl.java:120)
at twitter4j.AlternativeHttpClientImpl.getConnection(AlternativeHttpClientImpl.java:60)
at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:88)
at twitter4j.AlternativeHttpClientImpl.handleRequest(AlternativeHttpClientImpl.java:104)
at twitter4j.HttpClientBase.request(HttpClientBase.java:53)
at twitter4j.HttpClientBase.get(HttpClientBase.java:71)
at twitter4j.TwitterBaseImpl.fillInIDAndScreenName(TwitterBaseImpl.java:128)
at twitter4j.TwitterImpl.verifyCredentials(TwitterImpl.java:545)
如何讓這個工作?
您是否將所有必需的jar文件添加到應用程序中以使其工作? – VinayVeluri 2014-09-25 12:08:53
是包括twitter4j-core.jar添加,twitter4j-async.jar,twitter4j-媒體support.jar – 2014-09-25 12:13:46