• Post Reply Bookmark Topic Watch Topic
  • New Topic

Open - Close exe  RSS feed

 
Vrabie Cristian
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I know how to open an *.exe from an Java program but once oppened how can I close it. In C++ I could just open it like an procces. Is there something simmilar in Java? Thank you!
 
Yaroslav Chinskiy
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once u start the program, it should ceate a process.

Look at the Process at java.lang. It should have destroy() method that kills the started process.
 
Vrabie Cristian
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand but just can't make it work. Can you help me with some piece of code?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the overloaded exec() methods in the Runtime class to start a process.



Now, as this has nothing to do with Threads, per se, I'm moving ot to Java in General (Intermediate.) Followups there, please.
 
Vrabie Cristian
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
got it now!
Thank you very much!
 
Yaroslav Chinskiy
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a link that shows some code for Runtime.exec

http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
 
Vrabie Cristian
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice, thank you again! Got it to work perfectly!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!