Integrating Twitter via Java

This you want to integrate to Twitter from Java you can use the following library JTwitter.

Try out the twitter integration with the following coding:

package de.vogella.twitter.test;

import java.util.List;

import winterwell.jtwitter.Twitter;
import winterwell.jtwitter.Twitter.User;

public class TwitterTest {
	private static final String user ="your-user";
	private static final String pw ="your-password";
	public static void main(String[] args) {
		// Make a Twitter object
               Twitter twitter = new TwitterFactory().getInstance(user,pw);
		// Print Lars Vogel status
		// Set my status
		twitter.setStatus("@vogella messing with Twitter in Java");
		List<User> followers = twitter.getFollowers();
		for (User user : followers) {

Another Java Twitter Library is Twitter4J.

About Lars Vogel

Lars Vogel is the founder and CEO of the vogella GmbH and works as Eclipse and Android consultant, trainer and book author. He is a regular speaker at international conferences, He is the primary author of With more than one million visitors per month this website is one of the central sources for Java, Eclipse and Android programming information.
This entry was posted in Java, Web and tagged . Bookmark the permalink.

5 Responses to Integrating Twitter via Java

  1. Meera says:

    Hi Lars,
    Have you written any Java application using Facebook? What libraries do you need and do you have any sample code?

  2. Lars Vogel says:

    @Meera: No, so far I have not develop for Facebook

  3. Fazal says:

    @Meera: You can develop Java application which connects to Facebook using the facebook-java-api project hosted on Google Code []. Te only thing is Facebook does not support this project officially because of which the APIs are updated once in a while only.

  4. orang_letrik says:

    just sent my first tweet using these library


Comments are closed.