-
December 8th, 2010, 05:54 AM
#1
invoke a process from main program and exit the main program
My requirement is from the main java program, I need to invoke another program on unix platforms and once this process is invoked, main program should exit.
But the problem I see is, before the sub program gets launched or invoked, the main program is exiting.
How to resolve this issue elegantly?
For time being I used Thread.sleep() for some amount of time in main program.
But the sleep amount could vary from system to system depending on the load.
If I use process.waitFor(), the main program waits till the end of sub program-- which I dont want.
Thanks in advcane for any help or guidence in this direction.
-
December 8th, 2010, 07:17 AM
#2
Re: invoke a process from main program and exit the main program
You can't launch the program directly if you want the Java program to exit before the launched program completes. You need to launch a native process that creates a new process to run the application. Not sure how you do it on unix but I think you can do it on windows by launching a command shell and executing the 'start' command. There's bound to be something on unix to do something similar to this.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|