I am trying to use Oauth with jTwitter.. and get an exception while creating the Oauth signpostclient
String JTWITTER_OAUTH_KEY="GDdmIQH6jhtmLUypg82g"; String JTWITTER_OAUTH_SECRET="9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8"; OAuthSignpostClient client = new OAuthSignpostClient(JTWITTER_OAUTH_KEY, JTWITTER_OAUTH_SECRET,"oob");
throws the following exception
Exception in thread "main" java.lang.NoSuchMethodError: oauth.signpost.AbstractOAuthConsumer.(Ljava/lang/String;Ljava/lang/String;)V at winterwell.jtwitter.OAuthSignpostClient$2.(OAuthSignpostClient.java:182) at winterwell.jtwitter.OAuthSignpostClient.init(OAuthSignpostClient.java:182) at winterwell开发者_JAVA技巧.jtwitter.OAuthSignpostClient.(OAuthSignpostClient.java:144) at jay.twitter.HelloTwitter.main(HelloTwitter.java:16)
What am I doing wrong? Can anyone help pls.
You need to download the signpost oauth jar and add it to your classpath/project. JTwitter works with a few different oauth libraries, but the download doesn't include any of them.
By the way, itls a good idea to get your own key & secret by registering at dev.twitter.com.
- download signpost.jar
- add it to your class path/project
Hope will get solution
You probably has no OAuth library.
There is a number of libraries available, but I recommend using signpost. If you are using eclipse, you should do this by:
right clicking on the project -> Build Path -> Configure Build Path
And then click "Add Jar" if the signpost jar is in within your files or "Add External Jar" if it is somewher else.
Finally, you should have an twitter app in order to twitter talk to yout app and have the strings for . In order to do this, you should sign up your twitter account as developer in developer.twitter.com and then create your app on twitter. And then you will have your own values for JTWITTER_OAUTH_KEY and JTWITTER_OAUTH_SECRET (if you don't have yet).
精彩评论