execute shell script from a java app

  • Thread starter =?ISO-8859-1?Q?Peter_H=F6ltschi?=
  • Start date
?

=?ISO-8859-1?Q?Peter_H=F6ltschi?=

Dear all
I'm able now to execute a shell script from my java application. But how
can I get the results from the shell and safe them in variables? Lets
say my shell scripts executes 'arch'. The return value would be 'i686'.
How can I get this value in a String variable?

Thanks Peter
 
M

Michael Borgwardt

Peter said:
I'm able now to execute a shell script from my java application. But how
can I get the results from the shell and safe them in variables? Lets
say my shell scripts executes 'arch'. The return value would be 'i686'.
How can I get this value in a String variable?

Runtime.exec() returns a Process object. That allows you to get the
standard output of the programm as an InputStream.
 

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

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top