This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Java in General and the fly likes Creating a process from Java Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Creating a process from Java " Watch "Creating a process from Java " New topic
Author

Creating a process from Java

Karthikeyan Chandrasekaran
Greenhorn

Joined: Feb 10, 2006
Posts: 15
Hi All,

I have a swing GUI from which i am calling a batch file using RunTime.exec() . That batch file will kill and restart the GUI. But when it kills the GUI it itself got killed. So GUI is not coming up. Please let me know how to overcome this issue?
Ankur Sharma
Ranch Hand

Joined: Dec 27, 2005
Posts: 1234
Originally posted by Karthikeyan Chandrasekaran:
Hi All,

I have a swing GUI from which i am calling a batch file using RunTime.exec() . That batch file will kill and restart the GUI. But when it kills the GUI it itself got killed. So GUI is not coming up. Please let me know how to overcome this issue?


Please share the code of Batch file so that we can check whether what you have coded in that program.

what do you mean by "restart the GUI" does that means starting the application from where it was called or restart the GUI.

If you want to restart the GUI from the scratch again then you have to simply write a line
java GUIApplicationClass

else otherwise let us see the code first.


The Best way to predict your future is to create it
Ankur Sharma
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16811
    
  19

This is actually pretty common with many Operating Systems. When a process gets killed, the operating system may go after it's children too.

There is no one answer that will work in all cases... but some options include have the child protect itself from kill signals, detach from parent by closing stdin and stdout, executing another script, etc.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Karthikeyan Chandrasekaran
Greenhorn

Joined: Feb 10, 2006
Posts: 15
Could you let me know how to create a detached(from parent) independant process from java?
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Creating a process from Java
 
Similar Threads
thread pause after calling a batch file
How to Run a batch file???
Reg: ActionListener
Need help writing non-gui JMF program
WSDL2JAVA not generating all the classes with Axis 1.4