Using Twitter4J

   

-Initial configuration/setup 
-Fetching your home timeline

Twitter4J


What is Twitter4J?
http://twitter4j.org/

-A relatively simple Java Library for the Twitter API
-Enables easy integration between your Java application with the Twitter Service

Download and Configure (Eclipse)

http://twitter4j.org/en/index.html#download (unzip file)
In Eclipse: Right-click on target project and select Build Path-->Configure Build Path...

Configuring Eclipse


Under the Libraries Tab, select "Add External JARs..."

Configuring Eclipse

In the JAR Selection prompt, navigate to twitter4j-3/lib/twitter4j-core-3.0.x.jar and hit Open

Twitter Settings

First you must sign into dev.twitter.com

Click near your profile picture and navigate to "My applications"

Setting up Twitter

Create a new application

Enter the information it requires, URL can be any working page you own, must be in full "http://xyz.com/" format


Setting up Twitter

Hit the button to Create New Access Tokens...
It may take some time to generate the access tokens

Linking your account to your Java Project

To embed your log-in information you must create a file with the name "twitter4j.properties"

Include the following data in this plain-text file:

debug=true
oauth.consumerKey=*********************
oauth.consumerSecret=******************************************
oauth.accessToken=**************************************************
oauth.accessTokenSecret=******************************************


Getting Started with Twitter4J

By Srihari Rao

Getting Started with Twitter4J

Basic introduction to setting up Eclipse w/ Twitter4J, twitter settings for OAuth, and the Java code/settings necessary to fetch your home timeline

  • 1,303