Mirage Source
JAVA Run code when program ends - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Programming (https://mirage-engine.uk/forums/forumdisplay.php?fid=24)
+----- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=27)
+----- Thread: JAVA Run code when program ends (/showthread.php?tid=3082)



JAVA Run code when program ends - Labmonkey - 24-08-2009

I need to run some code (unload stuff etc) when the program ends. It is a program not an applet. Anybody know the method to use?


Re: JAVA Run code when program ends - Coke - 24-08-2009

Ends how? If someone kills the VM you are fucked. How will the application be ending?


Re: JAVA Run code when program ends - Labmonkey - 24-08-2009

Well I worked around this, but i was thinking like when I press stop in the ide. But yea, I just tweaked my code so i am not using all of the files etc at all times, and so i can unload them when I'm done using them, instead of when the program closes. Seems like a good thing to know though.


Re: JAVA Run code when program ends - grimsk8ter11 - 24-08-2009

http://java.sun.com/docs/books/tutorial ... tDemo.java

an example of how to setup and use WindowListener. I just started playign with it yesterday myself.