• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

a bug in the Runtime class

 
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[code]
public class Test{
public static void main(String args[])throws Exception {
Runtime rt=Runtime.getRuntime();
Process p=rt.exec("java Test");
System.out.println("asdasdada");
System.out.println(p.waitFor());

}
}
[\code]
here i am running the same file being inside the same file...
but it is unable to run new program..
can any one tell me why it is unable to run a program in loop form
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's hard to say what's going on since you don't mention what is going on (just that something doesn't work), but -as this article explains- you may need to use the full path of the "java" executable, and you probably need to handle the output that the child process generates.
 
I don't like that guy. The tiny ad agrees with me.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic