File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Save output of command prompt in JTextarea. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Save output of command prompt in JTextarea." Watch "Save output of command prompt in JTextarea." New topic
Author

Save output of command prompt in JTextarea.

Siddharth Mitesh
Greenhorn

Joined: Jan 15, 2004
Posts: 10
Hello friends,
In my program i made 1 screen, in that i put 1 textarea and 1 button.
When user press that button i want to run ping command and its output i want in textarea.
How can i do that, give fast reply its urgent for me.
Thanx
Eddie Vanda
Ranch Hand

Joined: Mar 18, 2003
Posts: 281
Hi Siddharth,
This is not a simple task. The java Socket class does not allow low level access to the TCP/IP stack. You could use Runtime.exec () to run the ping command with a redirection of its output to a file, which you can then disect for results.
Some other rancher may have done this and might be prepared to post their code. However, be aware that this would be a platform dependent hack.
Ed


The nice thing about Standards is that there are so many to choose from!
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Save output of command prompt in JTextarea.
 
Similar Threads
Display UNIX Commands in TextArea
Runtime.exec() doesnt seem to work.
insert text from servlet to textarea of html
command prompt output to text area
Regarding Swing TextArea