I\'m developing a simple application to manage the operational part of a business using Swing, but I need that when the application exits, it performs this:
Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { updateZonas(); db.close(); } });
This works for any Java application(Swing/AWT/Console)