File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Firing statements into Command prompt. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Firing statements into Command prompt. " Watch "Firing statements into Command prompt. " New topic
Author

Firing statements into Command prompt.

Gautam Dembla
Greenhorn

Joined: Mar 23, 2005
Posts: 9
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

Joined: Aug 12, 2002
Posts: 102
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

Joined: Mar 23, 2005
Posts: 9
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

Joined: Jan 10, 2002
Posts: 60050
    
  65

Guatam, please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Firing statements into Command prompt.
 
Similar Threads
Firing statements into Command prompt.
ping IP from JSP page and show result in client's command prompt
How to connect JSP and MS-dos
Dynamically Adding Row in JSF
Firing statements into Command prompt.