JTwitter - the Java library for the Twitter API
JTwitter - the Java library for the Twitter API
Over 50,000 downloads and many successful apps. As used in several university courses.

The Smart Social Dashboard
JTwitter is a small library providing easy access to the Twitter API. Set and get your status, manage your network of friends, message friends, maintain lists, etc. Lots of features - if you can do it at twitter.com, you can probably do it with JTwitter.
The library - version 1.7 - can be downloaded here: [jtwitter.jar]
You will also need an OAuth library - we recommend Signpost: [signpost jar]
The recent 1.6+ versions are a major update to JTwitter adding better OAuth support, extra services such as search and lists, and fixing several issues. If you are using an older version, please download the new version.
The source code is included inside the jar file. It is also available online here: [Twitter.java]
JTwitter is very easy to use. Example usage:
// Make an oauth client (you'll want to change this bit)
OAuthSignpostClient oauthClient = new OAuthSignpostClient(JTWITTER_OAUTH_KEY, JTWITTER_OAUTH_SECRET, "oob");
// Open the authorisation page in the user's browser
// On Android, you'd direct the user to URI url = client.authorizeUrl();
// On a desktop, we can do that like this:
oauthClient.authorizeDesktop();
// get the pin
String v = oauthClient.askUser("Please enter the verification PIN from Twitter");
oauthClient.setAuthorizationCode(v);
// Store the authorisation token details for future use
Object accessToken = client.getAccessToken();
// Make a Twitter object
Twitter twitter = new Twitter("my-name", oauthClient);
// Print Daniel Winterstein's status
System.out.println(twitter.getStatus("winterstein"));
// Set my status
twitter.setStatus("Messing about in Java");
You'll find the code is fully documented, and mostly self-explanatory. The javadoc is also available online here: [javadoc], with the change-log (including credits to contributors) here: change log.
OAuth support
OAuth support is provided in three flavours:
- Recommended: OAuthSignpostClient which requires the Signpost OAuth library. This is OAuth library I use. (documentation).
- OAuthScribeClient which requires the Scribe OAuth library and the Apache commons codec. (documentation).
- OAuthHttpClient.java, which requires the Java OAuth library and its considerable dependencies. The OAuthHttpClient.java file should be extracted from the jar and copied into your project if you want to use it.
The JTwitter download does not include the extra dependencies required. In order to use OAuth, you also need an OAuth library (Signpost, Scribe or Java OAuth).
C# / .NET version
Thanks to Patrick Schidler, JTwitter has been ported to C# and is available for the .Net framework. NTwitter is available here: http://www.blogmenot.de.Feedback
New: There is now a: low-volume mailing list for JTwitter. This is the best place to post bugs, feedback, and let me know how you're using JTwitter. You can also contact Daniel directly on .
Copyright and License
Developed by Daniel Winterstein.
This code is copyright (c) Winterwell Associates Ltd, 2008-2010 and ThinkTank Mathematics Ltd, 2007, except where
otherwise stated. It is released as
open-source under the LGPL license.
This code comes with no warranty or support.
You must let your users know that you are using the JTwitter library, which they can get the source code for. A credit on your home page with a link-back to this page, e.g. built using JTwitter, is the recommended way to do this. Your own code can be licensed commercially and you do not have to release the source code.
