Java examples for Social Media:Twitter
Update Twitter status
import twitter4j.Twitter; import twitter4j.TwitterException; import twitter4j.TwitterFactory; import twitter4j.auth.AccessToken; public class PostTweet { private static String consumerKey = "key"; private static String consumerSecret = "key"; private static String accessToken = "token"; private static String accessTokenSecret = "token"; public static void main(String[] args) throws TwitterException { Twitter twitter = new TwitterFactory().getInstance(); twitter.setOAuthConsumer(consumerKey, consumerSecret); twitter.setOAuthAccessToken(new AccessToken(accessToken, accessTokenSecret));//from www. j a v a2 s . co m twitter.updateStatus("Hi!"); } }