I will explain here how can you retrieve your Twitter post/data using JAVA (Net-beans).
Follow these steps-
Download twitter4j —
Firstly you have to download a zip file of Twitter4j for getting the data. You can download from this –http://twitter4j.org after downloading you have to extract all files.
Create a twitter developer account —
This is the link where you can create your developing account https://developer.twitter.com then create an application to get Consumer Key and Access token key which is to be used in your java Application.
Add twitter4j JAR files into your project library —
You can follow these steps for adding – Open your project / go to properties / select libraries / Add new JAR/ folder then navigate to that position where you download twitter4j jar files.
Add following code into your App-
import twitter4j.TwitterFactory; import twitter4j.conf.ConfigurationBuilder; import twitter4j.Status; import twitter4j.*; public class twitterinfo extends javax.swing.JFrame { public twitterinfo() { initComponents(); } public static void main(String args[]) throws TwitterException { ConfigurationBuilder cb=new ConfigurationBuilder(); cb.setDebugEnabled(true); cb.setOAuthConsumerKey("******************************"); cb.setOAuthConsumerSecret("******************************************"); cb.setOAuthAccessToken("********************************"); cb.setOAuthAccessTokenSecret("*********************************************"); TwitterFactory tf; tf = new TwitterFactory(cb.build()); twitter4j.Twitter twitter=tf.getInstance(); ResponseList<Status> status; status = twitter.getHomeTimeline(); status.forEach((s) -> { System.out.println(s.getUser().getName()+" "+s.getText()); }); System.setProperty("java.net.useSystemProxies", "true"); } }
You will see your posts are displayed at Netbeans Console.
Thanks.