Monday, April 20, 2009

How to Use Twitter API for Java

About Twitter API

Go to - Twitter API Documentation
It is recommended to follow the twitter API group - @twitterapi as well as subscribing to twitter REST API Changelog RSS (at the bottom of the page)

You can use twitter API directly or use it via open sources on top of twitter API. There open sources for many languages. The one I’m going to use is for Java, Twitter4J.

Using Twitter4J
  1. Download Twitter4J zip file.
  2. Extract the downloaded file
  3. Try to run the examples – go to the bin folder and run the [example].cmd or [example].sh (according to your system environment).
    You might want to update the setEnv first to use your JAVA_HOME.

    For example:
    I’m using Windows XP. I changed the JAVA_HOME in the setEnv.cmd to be JAVA_HOME=”C:\Program Files\Java\jre1.6.0_06” (with the quotation marks!) opened the cmd and run the following command from the bin folder –
    update.cmd “I’m updating my status”
    This resulted in an updated message in my profile.

To setup the Java environment please view the previous post
Setting Up a Java Work Environment.

No comments:

Post a Comment