• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ......
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
 
Campbell Ritchie
Sheriff
Pie
Posts: 49823
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic