I have an application that I developed/tested under 32bit Win (XP and Win7) and eclipse (indigo). I deploy the application using File->Export->Runnable Jar (with "package required libraries into generated JAR"). From there I wrap it into an executable.
I recently noticed that my application can not be closed (by neither the "top right X" nor alt+F4) in 64bit Win7 (32bit Win works fine). I started playing arround in 64bit Win7 and found out, that when started from eclipse, I can close the application. After I exported it into a runnable jar, I can not close it. Every other part of my application works fine (also under 64bit Win7).
I have a shutdown hook running like this:
// initialize JFrame frame;
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
closeApplication();
}
});
frame.setVisible(true);
public void closeApplication() {
while (ConnectionManager.isConnected())
try {
ThreadManager.addMeasRequestPriority(eMeasRequest.DISCONNECT);
Thread.sleep(100);
} catch (InterruptedException e) {}
ConfigurationManager.saveToXML(new File("ressources/settings/startup.xml"));
System.exit(0);
}
I noticed that the GUI is disconnecting, but nothing more (but this means, that closeApplication()
is entered). The problem is that I don't have the System.out
when I am not running it in eclipse, so I can not see if there is any exception or what is going on. Do you have an idea how I could find the problem (or already know the problem)?
Possible candidates:
- System.exit(0) has a different behaviour under 64bit (why would that be and is there an alternative?)
- I can not create/write to the given file
startup.xml
(how can I check that?) - A tiny dwarf inside my 64bit Win7 laptop short circuits some stuff on the motherboard with his iron hammer and thus prevents the application from closing (how could I remove him?)
- other
I would appreciate it if you could either tell me, whats going on here or how you would proceed to find out more.
EDIT: Thanks for your fast replies. I have found out, that I get the following exception:
java.io.FileNotFoundException: ressources\settings\startupPlot0.apph (Access denied)
at java.io.FileOutputStream.open(Native Method)
...
But how can this be? This file definitely exists and is written to in non-64bit Win. Also, there are other files in the same directory that are written to just before the exception occurs on that file. They work (I just checked them). The only difference: For the other files, I use a new OutputStreamWriter(new FileOutputStream(File file))
for the other files and a new DataOutputStream(new FileOutputStream(File file))
for this one.