Forums Register Login

Closing another application using java code

+Pie Number of slices to send: Send
Hi all.
I need help. Following code I use to run or Launch another application



if the above code is to launch another application using java then how can I close/exit the same(another) application using java code once I press the exit button of my java app
+Pie Number of slices to send: Send
You can't. It's not like JavaScript where the processes are related. Once you kick off a program like this from Java, it lives independently.
+Pie Number of slices to send: Send
Thanks a ton for the quick reply Jeanne Boyarsky

I was looking for the solution on the net and I came across

what does this do then?
reference:
Please go through this
+Pie Number of slices to send: Send
Actually I read that bu did not understand too much!
+Pie Number of slices to send: Send
That method takes a Thread as a parameter. Which means it has to be another Java thread, not a DDL.

public void addShutdownHook(Thread hook)

http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread)
1
+Pie Number of slices to send: Send
That allows you to execute Java code when the JVM is shut down - it does not help in your scenario (unless you want to call native Windows code via JNI that can close the other app).
+Pie Number of slices to send: Send
 

That method takes a Thread as a parameter. Which means it has to be another Java thread, not a DDL.

public void addShutdownHook(Thread hook)

http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread)



Hmm that means there no option then!

That allows you to execute Java code when the JVM is shut down - it does not help in your scenario (unless you want to call native Windows code via JNI that can close the other app).


This is what I was looking for.! Great Thanks again to both of you for helping me!
Cheers
The fastest and most reliable components of any system are those that are not there. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2404 times.
Similar Threads
Why isn't this program working?
To quit window by button
How to open different documents to the same browser?
Ending a thread without ending the JVM
Swing Memory Issue
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 08:41:34.