devshift / jnativehook

Automatically exported from code.google.com/p/jnativehook
0 stars 0 forks source link

JNativeHook does suddenly stopped working #46

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the GlobalMouseListenerExample

What is the expected output? What do you see instead?
Example should listen to mouse events, but program exits instead.

What version of the product are you using? On what operating system?
I am using:
JRE 7u41 on Windows 7 (JNativeHook version 1.1.4)

Please provide any additional information below.
I started using JNativeHook and it worked perfectly. Then, after a few runs it 
stopped working completley. Instead of running a listener thread as it should, 
the program now just exits. I don't think i have done anything special between 
the runs. It ran smoothly for like 20 or 30 runs (i'm always exiting by 
terminating the JVM directly, if that matters) and then suddenly it just 
stopped. there are no exceptions thrown or anything, it just seems that the 
program is not running the listener and exits. It also happens to me on the 
vanilla mouse listener example provided with JNativeHook.
I really like this lib, any help is appreciated

Tx in advance

Original issue reported on code.google.com by angeli...@gmail.com on 14 May 2013 at 10:22

GoogleCodeExporter commented 9 years ago
Restarting windows seems to help, is there any way to avoid this? what is the 
correct way of terminating the jvm using JNativeHook?

Original comment by angeli...@gmail.com on 14 May 2013 at 11:57

GoogleCodeExporter commented 9 years ago
Sounds like a bug or conflict with another piece of software.  You shouldn't 
have to do anything special when terminating.  My want to check out #43 and see 
if the LowLevelHooksTimeout registry key may have something to do with it.

Original comment by a...@1stleg.com on 15 May 2013 at 3:38

GoogleCodeExporter commented 9 years ago
Also getting bug. Exactly the same setup ad described in the report. 

Original comment by mooman...@gmail.com on 31 May 2013 at 10:48

GoogleCodeExporter commented 9 years ago

Original comment by a...@1stleg.com on 3 Jul 2013 at 5:40

GoogleCodeExporter commented 9 years ago
The same issue. But I made observation, that is when the hooks stooping to work 
the following code:System.gc();
     try {
             GlobalScreen.registerNativeHook();
     }
     catch (NativeHookException ex) {
             System.err.println("There was a problem registering the native hook.");
             System.err.println(ex.getMessage());
             System.exit(1);
     }
     System.out.println("Hook state: "+ GlobalScreen.isNativeHookRegistered());
     System.out.println("Hook state: "+GlobalScreen.isNativeHookRegistered());
     System.out.println("Hook state: "+GlobalScreen.isNativeHookRegistered());

when you run it several times one afte another, it shows like random output.
Sometims it's three  trues', sometimes true and two false, sometimes two true's 
and last one is false.  I didn't noticed any pattern in output in many 
consecutive run.

Original comment by uncle.pe...@gmail.com on 19 Feb 2014 at 3:18

GoogleCodeExporter commented 9 years ago
It sounds like you are experiencing a known Windows thread safety issue in 
version 1.1.4 that should be resolved in 1.2.0.  It returns true but then the 
thread fails and it starts returning false.  1.2 will block until the thread 
has fully started but does/can not address why the 
GlobalScreen.registerNativeHook() fails.  See issue 43 and issue 63 for more 
information.

Original comment by a...@1stleg.com on 19 Feb 2014 at 6:12