• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting return values from EXE  RSS feed

 
narayana murthy pedapudi
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
how can i get the return values from the exe, i am calling an EXE file by using the following code, i am able to send the parameters to the exe,
but how can i get the return values from that...
please help me

Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("c:\\Badger\\PowerTap.exe "+pathComplete);
narayana
 
tomer peretz
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you tried
proc.exitValue();
 
VIJAY Yadlapati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this code sample:
Process p = Runtime.getRuntime().exec("xxx.EXE p1 p2");
// This is as same as what we do at DOS Prompt.
InputStream is = p.getInputStream();
int n = 0;
while(n != -1)
{
n = is.read();
System.out.print(n);
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!