T
TheRhythmic
Hi everyone,
This' the issue am facing:
A java application is runs forever. I want to provide the users a
facility to shut it down whenever they want to. How to do this?
I tried writing another class, say class A, which does this:
Runtime r = Runtime.getRuntime();
r.exit(o);
I started the App. Then when I wanted to shut it down, I executed class
A's method by using the 'java' command. But this doesn't seem to help
in stopping the App. A's method executes successfuly, but I think it
starts a new JVM & executes in it & so the exit() command doesn't have
effect on the JVM in which the App is running.
One more method I thought of is to execute a method in the same JVM &
do an 'exit(0)' to terminate the JVM so that App will shut down. But
donno how this'll be possible because 'java' command starts a new JVM.
Please give your suggestions on what can be done.
Thanks.
This' the issue am facing:
A java application is runs forever. I want to provide the users a
facility to shut it down whenever they want to. How to do this?
I tried writing another class, say class A, which does this:
Runtime r = Runtime.getRuntime();
r.exit(o);
I started the App. Then when I wanted to shut it down, I executed class
A's method by using the 'java' command. But this doesn't seem to help
in stopping the App. A's method executes successfuly, but I think it
starts a new JVM & executes in it & so the exit() command doesn't have
effect on the JVM in which the App is running.
One more method I thought of is to execute a method in the same JVM &
do an 'exit(0)' to terminate the JVM so that App will shut down. But
donno how this'll be possible because 'java' command starts a new JVM.
Please give your suggestions on what can be done.
Thanks.