Closed GoogleCodeExporter closed 9 years ago
It could be one of two problems. Either your JRE is calling windowClosed()
from outside of the AWT Event dispatch thread or there is a to much
optimization bug in the native code.
What Java runtime are you using?
Does that happen every time you run the program?
Do the attached jar files produce the same results? If not, let me know which
one fails.
Original comment by alex%1st...@gtempaccount.com
on 2 Jul 2012 at 6:12
Attachments:
Hi,
I'm using java version: 1.6.0_24-b07
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
The bug happens every time.
The bug happens with the demo code provided in the
jar: org.jnativehook.example.NativeHookDemo
I can reproduce by running the following from the command line:
java -jar JNativeHook.jar
The attachments you sent didn't come through, perhaps Gmail stripped them
off.
I think you're right about the way the thread is getting shut down, I made
the following edits to NativeHookDemo and it seems to have solved the
problem.
In the NativeHookDemo constructor I added:
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
public void windowClosed(WindowEvent e) {
-- snip --
// Remove these 2 lines
// System.runFinalization();
// System.exit(0);
}
In Main, I believe it is now
recommended<http://bitguru.wordpress.com/2007/03/21/will-the-real-swing-single-t
hreading-rule-please-stand-up/>that
Swing components are created in the AWT event thread.
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable()
{
public void run() {
new NativeHookDemo();
}
});
}
Andrew
Original comment by awbra...@gmail.com
on 2 Jul 2012 at 1:58
The jar files are attached to the bug report on google code.
Original comment by alex%1st...@gtempaccount.com
on 2 Jul 2012 at 4:40
Both JNativeHook_Test1.jar and JNativeHook_Test2.jar run without
exception.
Andrew
Original comment by awbra...@gmail.com
on 2 Jul 2012 at 5:51
Should be fixed in revision 557
Original comment by alex%1st...@gtempaccount.com
on 2 Jul 2012 at 6:56
Original issue reported on code.google.com by
awbra...@gmail.com
on 12 Jun 2012 at 2:19