Jump to content

how is it out putting text? cmd? .txt

My Car: http://linustechtips.com/main/topic/274320-the-long-awaited-car-thread/?p=4442206


CPU: i5 4590 |Motherboard: ASRock H97M PRO4|Memory: Corsair Vengance 8gbs|Storage: WD Caviar Blue 1TB|GPU: ZOTAC GTX 760 2gb|PSU: Thermaltech TR2 500W|Monitors: LG24M35 24" & Dual 19"|Mouse:Razer DeathAdder 2013 with SteelSeries Qck mini|Keyboard: Ducky DK2087 Zero MX Red|Headset: HyperX Cloud|Cooling: Corsair 120mm blue LED, Lepa vortex 120mm, stock 120mm|Case:Enermax Ostrog Blue Windowed


 

Link to post
Share on other sites

Make a new app here: https://apps.twitter.com/

Follow the details here: http://www.codingpedia.org/ama/how-to-post-to-twittter-from-java-with-twitter4j-in-10-minutes/#The_example

to get the access codes, you need to add phone number to your twitter account to add write permission to your app.

 

Add the twitter4j jar to your project.

This code snippet should work, but I haven't tested it with the authentication codes.

Once the Twitter object is set up, you should be able to post a message with twitter.updateStatus("message");

import twitter4j.Status;import twitter4j.Twitter;import twitter4j.TwitterException;import twitter4j.TwitterFactory;import twitter4j.conf.ConfigurationBuilder;public class Test {	public static void main(String[] args) {		new Test();	}		private Twitter twitter;	public Test() {                // set up code		ConfigurationBuilder cb = new ConfigurationBuilder();		cb.setDebugEnabled(true)						.setOAuthConsumerKey("****************")				.setOAuthConsumerSecret(						"**************************************************")				.setOAuthAccessToken(						"***************************************************")				.setOAuthAccessTokenSecret(						"************************");		TwitterFactory tf = new TwitterFactory(cb.build());		twitter = tf.getInstance();		                // post message		try {			twitter.updateStatus("Test Message");		} catch (TwitterException e) {			e.printStackTrace();		}	}}
Link to post
Share on other sites

 

Make a new app here: https://apps.twitter.com/

Follow the details here: http://www.codingpedia.org/ama/how-to-post-to-twittter-from-java-with-twitter4j-in-10-minutes/#The_example

to get the access codes, you need to add phone number to your twitter account to add write permission to your app.

 

Add the twitter4j jar to your project.

This code snippet should work, but I haven't tested it with the authentication codes.

Once the Twitter object is set up, you should be able to post a message with twitter.updateStatus("message");

import twitter4j.Status;import twitter4j.Twitter;import twitter4j.TwitterException;import twitter4j.TwitterFactory;import twitter4j.conf.ConfigurationBuilder;public class Test {	public static void main(String[] args) {		new Test();	}		private Twitter twitter;	public Test() {                // set up code		ConfigurationBuilder cb = new ConfigurationBuilder();		cb.setDebugEnabled(true)						.setOAuthConsumerKey("****************")				.setOAuthConsumerSecret(						"**************************************************")				.setOAuthAccessToken(						"***************************************************")				.setOAuthAccessTokenSecret(						"************************");		TwitterFactory tf = new TwitterFactory(cb.build());		twitter = tf.getInstance();		                // post message		try {			twitter.updateStatus("Test Message");		} catch (TwitterException e) {			e.printStackTrace();		}	}}

 

 

Alright! Thanks!

Link to post
Share on other sites

 

Make a new app here: https://apps.twitter.com/

Follow the details here: http://www.codingpedia.org/ama/how-to-post-to-twittter-from-java-with-twitter4j-in-10-minutes/#The_example

to get the access codes, you need to add phone number to your twitter account to add write permission to your app.

 

Add the twitter4j jar to your project.

This code snippet should work, but I haven't tested it with the authentication codes.

Once the Twitter object is set up, you should be able to post a message with twitter.updateStatus("message");

import twitter4j.Status;import twitter4j.Twitter;import twitter4j.TwitterException;import twitter4j.TwitterFactory;import twitter4j.conf.ConfigurationBuilder;public class Test {	public static void main(String[] args) {		new Test();	}		private Twitter twitter;	public Test() {                // set up code		ConfigurationBuilder cb = new ConfigurationBuilder();		cb.setDebugEnabled(true)						.setOAuthConsumerKey("****************")				.setOAuthConsumerSecret(						"**************************************************")				.setOAuthAccessToken(						"***************************************************")				.setOAuthAccessTokenSecret(						"************************");		TwitterFactory tf = new TwitterFactory(cb.build());		twitter = tf.getInstance();		                // post message		try {			twitter.updateStatus("Test Message");		} catch (TwitterException e) {			e.printStackTrace();		}	}}

uhh, what is callback URL?

Link to post
Share on other sites

 

Make a new app here: https://apps.twitter.com/

Follow the details here: http://www.codingpedia.org/ama/how-to-post-to-twittter-from-java-with-twitter4j-in-10-minutes/#The_example

to get the access codes, you need to add phone number to your twitter account to add write permission to your app.

 

Add the twitter4j jar to your project.

This code snippet should work, but I haven't tested it with the authentication codes.

Once the Twitter object is set up, you should be able to post a message with twitter.updateStatus("message");

import twitter4j.Status;import twitter4j.Twitter;import twitter4j.TwitterException;import twitter4j.TwitterFactory;import twitter4j.conf.ConfigurationBuilder;public class Test {	public static void main(String[] args) {		new Test();	}		private Twitter twitter;	public Test() {                // set up code		ConfigurationBuilder cb = new ConfigurationBuilder();		cb.setDebugEnabled(true)						.setOAuthConsumerKey("****************")				.setOAuthConsumerSecret(						"**************************************************")				.setOAuthAccessToken(						"***************************************************")				.setOAuthAccessTokenSecret(						"************************");		TwitterFactory tf = new TwitterFactory(cb.build());		twitter = tf.getInstance();		                // post message		try {			twitter.updateStatus("Test Message");		} catch (TwitterException e) {			e.printStackTrace();		}	}}

also, what does it mean to add the twitter4j jar to my project? I am using sublime text editor right now.

Link to post
Share on other sites

also, what does it mean to add the twitter4j jar to my project? I am using sublime text editor right now.

Ah, you could do it with sublime, but it would be a lot easier to use an ide such as eclipse (https://www.eclipse.org/).

If you look up how to make a project in eclipse and how to add a jar dependency you should be able to figure it out pretty easily.

Link to post
Share on other sites

Could you explain a bit more? I'm not sure what you mean.

When I go on the twitter developer site, it wants me to give them a callback URL.

 

 

Where should we return after successfully authenticating? OAuth 1.0a applications should explicitly specify their oauth_callback URL on the request token step, regardless of the value given here. To restrict your application from using callbacks, leave this field blank.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×