wood burning stoves*
The moose likes Java in General and the fly likes how to catch the output from a process after executing certain commands ? 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 » Java in General
Bookmark "how to catch the output from a process after executing certain commands ?" Watch "how to catch the output from a process after executing certain commands ?" New topic
Author

how to catch the output from a process after executing certain commands ?

naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 682

what i want is i should get a result by executing a command , for now java -version
i have implemented the solution in vb.net where i have created the process and passed the command
like
this gives the exact output as executing java -version at the cmd(command prompt)

i was trying to implement same solution in java by creating process
there are two ways one is through it is executing also but how to catch the return value i mean the actual output not the instance of
process.
another way is through this

but this again has the same problem
note : please don't give me solutions like put the java-version in a bat file and run that file ...because this doesn't fit into my requirements...
can any one help ?
thanks ......


The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36486
    
  16
Things are a little bit simpler now the ProcessBuilder class is available, but you must still follow the principles in the link Jeff Verdegan gave you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to catch the output from a process after executing certain commands ?
 
Similar Threads
Execute command line command with arguments within Web Application
Executing a jar in a Java program
Checkout from CVS using Maven
help using runtime.exec
How to use redirection when using ProcessBuilder