Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

java.lang.RunTime

  Asked By: Caleb    Date: Sep 16    Category: Java    Views: 1217
  

I have a common doubt in using java.lang.RunTime. If i execute a process using
RunTime from java can i get the question message throw by the executed process.

For example : I am executing copy command of windows. At that time if i copy an
existing file then the process will ask "Do you want overwrite?" meassge. I want
to capture that message and i want show it using System.out.println.

Can somebody help me on this.

Share: 

 

4 Answers Found

 
Answer #1    Answered By: Shelia Wells     Answered On: Sep 16

If your only copying a files why not use java.io instead?

 
Answer #2    Answered By: Roop Kapoor     Answered On: Sep 16

Basiaclly my doubt  is not on file  system. My doubt was in the RunTime. i.e. how
to capture  the question  message from a process? I used copy  command as an
example only.

 
Answer #3    Answered By: Abasi Massri     Answered On: Sep 16

The Runtime.exec() methods all return a process  instance. The Process
class includes methods for retrieving the error stream, input stream and
output stream of the process. You would need to try to read data from
the output stream and then send the appropriate data back to the process
through the input stream.

 
Answer #4    Answered By: Aylin Kaya     Answered On: Sep 16

Is this like writing a pipe?

We have to link input/output of process.

I would like to know.

 
Didn't find what you were looking for? Find more on java.lang.RunTime Or get search suggestion and latest updates.




Tagged: