Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Firing statements into Command prompt.

 
Gautam Dembla
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Wanted to know if there was a way i could fire a statement into command prompt and display the results on a label((eg. c:\>ping 172.16.2.214)
and display the results of the ping response on a label(which is refreshed every 50 milliseconds)).Displaying the results can be done by capturing the response in a .txt file and maybe using a threaded IO operation and readind the response onto a label.
Purpose of me doing this is, i want to fire a logical backup of the database from the front-end, similarly restoration of the database from the front-end..
Like incase of VB 6.0, I could give a Shell command and the statement would be executed in the command prompt.
Thanx All..
 
Susanta Chatterjee
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your question should go into "Java in general" forum.

Use one of the exec() methods of java.lang.Runtime class to execute an external application or o/s command. The exec methods return an instance of Process class, which can be used to obtain the standard i/o related to the executing process.

Here is a quick example.


A google search with "java runtime exec process" brought me some useful results.
[ March 23, 2005: Message edited by: Susanta Chatterjee ]
 
Gautam Dembla
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey thanx for the reply !!
i will try it in sometime, will keep u updated
sorry for having posted it in 2 differnt sections.
Will keep u posted abt my progress
Take Care
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64971
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guatam, please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic