Catching Dos console output from within Java Class

I

IchBin

Is it possible to not just to issue a Dos cmd from a java class but more
importantly encapsulate the Dos output back into a buffer that java can
use..? Not just pipe the Dos command to a dos file and then reading that
file. I am running under Windows XP SP 2. Reason: So I could say display
a running status of a NetStat command I want to monitor.

Sorry just never tried it.

--


Thanks in Advance...
IchBin
__________________________________________________________________________

'The meeting of two personalities is like the contact of two chemical
substances: if there is any reaction, both are transformed.'
- Carl Gustav Jung, (1875-1961), psychiatrist and psychologist
 
L

Lothar Kimmeringer

Is it possible to not just to issue a Dos cmd from a java class but more
importantly encapsulate the Dos output back into a buffer that java can
use..? Not just pipe the Dos command to a dos file and then reading that
file. I am running under Windows XP SP 2. Reason: So I could say display
a running status of a NetStat command I want to monitor.

Runtime.exec returns a Process-instance. Looking at the API
of java.lang.Process will give you all the information needed
and is more or less self-explaining.

If the called application is writing on STDERR as well you should
read the contents as well, because if the buffer is full, the
called application will block.


Regards, Lothar
--
Lothar Kimmeringer E-Mail: (e-mail address removed)
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
 
I

IchBin

Lothar said:
Runtime.exec returns a Process-instance. Looking at the API
of java.lang.Process will give you all the information needed
and is more or less self-explaining.

If the called application is writing on STDERR as well you should
read the contents as well, because if the buffer is full, the
called application will block.


Regards, Lothar

Thanks Lothar... You gave me the direction I needed.

--


Thanks in Advance...
IchBin
__________________________________________________________________________

'The meeting of two personalities is like the contact of two chemical
substances:
if there is any reaction, both are transformed.'
- Carl Gustav Jung, (1875-1961), psychiatrist and psychologist
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Comments... 0
Any HSQLDB Users 1
Changing a Panel at run time. 2
Question on Pattern Matcher? 5
Microsoft and Sun JVM ? 8

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top