This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Runtime.exec problem.....  RSS feed

 
abhishek kunal
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to call external dos commands through a java program, it appears running(as prompt doesn't get returned ) but i see no output.
please take a look...

Runtime rt=Runtime.getRuntime();
Process p=rt.exec("cmd /k ping 192.168.1.1 -t");
InputStream is = p.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
while ((sb = br.readLine()) != null)
{
sa += sb ;


}
System.out.println(sa);

even if i call command like iexplore or firefox,unexpectedly a new window shd have been opened but that's not happeing....please help...
 
Paul Clapham
Sheriff
Posts: 22471
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going to post what's probably the most-posted link in the history of Java forums:

When Runtime.exec() won't

Read it and do everything it says to do.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!