Can't run 1.2 stand-alone
Closed this issue · 8 comments
GoogleCodeExporter commented
When I try to run my built programs with 1.2.0-beta2 or 1.2.0-20140511, I get
this error:
{{{
c:\winprog\Keyboard Logger>java -jar KeyboardLogger.jar
JNativeHook: Global keyboard and mouse hooking for Java.
Copyright (C) 2006-2014 Alexander Barker. All Rights Received.
https://github.com/kwhat/jnativehook/
JNativeHook is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
JNativeHook is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\MarkJ\AppDat
a\Local\Temp\JNativeHook_8290646355922302333.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(Unknown Source)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at org.jnativehook.GlobalScreen.loadNativeLibrary(GlobalScreen.java:525)
at org.jnativehook.GlobalScreen.<init>(GlobalScreen.java:75)
at org.jnativehook.GlobalScreen.<clinit>(GlobalScreen.java:56)
at loggers.KeyboardLoggerMain.main(KeyboardLoggerMain.java:55)
c:\winprog\Keyboard Logger>java -jar KeyboardLogger.jar
JNativeHook: Global keyboard and mouse hooking for Java.
Copyright (C) 2006-2014 Alexander Barker. All Rights Received.
https://github.com/kwhat/jnativehook/
JNativeHook is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
JNativeHook is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\MarkJ\AppDat
a\Local\Temp\JNativeHook_8468859755287077212.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(Unknown Source)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at org.jnativehook.GlobalScreen.loadNativeLibrary(GlobalScreen.java:525)
at org.jnativehook.GlobalScreen.<init>(GlobalScreen.java:75)
at org.jnativehook.GlobalScreen.<clinit>(GlobalScreen.java:56)
at loggers.KeyboardLoggerMain.main(KeyboardLoggerMain.java:55)
}}}
Every time the number in the DLL filename is different, and more strangely, the
number of DLLs I find in that folder is always one less than the number of
times I ran the program (experimented with clearing the temp), and the numbers
are all different from the ones in the errors!
After clearing cache and two runs above I found only this DLL in temp:
JNativeHook_8278796009283724195.dll
When I run it from within the IDE (Eclipse), ir tuns fine. It only doesn't work
when I run an exported jar file of my program.
When I replace the jar with the old one I had, or with the newer 1.1.4,
everything works fine.
Original issue reported on code.google.com by mark.jeronimus@gmail.com
on 18 May 2014 at 7:11
GoogleCodeExporter commented
Sounds like a cross compiler issue with some dependency linked in that
shouldn't be. Use dependency walker (http://www.dependencywalker.com/) on one
of those dll files in temp will be able to tell you what library it is
expecting. What version of Windows are you using? 32/64 bit? What version and
of Java?
Original comment by a...@1stleg.com
on 18 May 2014 at 8:54
GoogleCodeExporter commented
[deleted comment]
GoogleCodeExporter commented
Tested on windows XP x64 (Windows server 2003) and Windows 7 starter.
Java 7u09, tried both x64 and x32, and both "java" and "javaw"
Original comment by mark.jeronimus@gmail.com
on 19 May 2014 at 4:56
GoogleCodeExporter commented
As I suspected, I cannot seem to duplicate the problem. Can you verify that
you have the following 4 dll's installed?
advapi32.dll
msvcrt.dll
kernel32.dll
user32.dll
That dependency Walker will tell you what is missing on your system. My best
guess is you are missing msvcrt.dll file.
Original comment by a...@1stleg.com
on 19 May 2014 at 8:48
GoogleCodeExporter commented
Dude, those are all highly essential Windows DLLs. Windows can't even run or
keep running when one is missing.
I tried Dependency Walker but I don't trust it for one bit. It says that one
DLL is missing in a 12 level deep tree. Halfway the tree there is a DLL that
only one function is used off that doesn't have anything to do with the DLL
next in the tree. Another DLL says "Entry point not bound". FYI the missing one
is MSJAVA.DLL
https://www.dropbox.com/s/skrxbpqqmvi368l/Screenshot_2014-05-20-07-34.jpg
Original comment by mark.jeronimus@gmail.com
on 20 May 2014 at 5:35
GoogleCodeExporter commented
The MSHTML.DLL module that was released with Windows XP SP2 and Windows 2003
SP1 has a delay-load dependency on MSJAVA.DLL. Missing delay-load dependencies
are not a problem as long as the calling DLL is prepared to handle the missing
module. Dependency Walker flags all potential problems as it cannot detect if
an application intends to handle the issue. In this particular case, MSJAVA.DLL
is an optional module, and MSHTML.DLL is prepared to handle it. This warning
can be ignored.
It looks like libgcc_s_sjlj-1.dll is being pulled in for the 32-bit dll,
probably as a result of
https://github.com/kwhat/libuiohook/blob/master/src/windows/hook_callback.c#L136
on 32-bit platforms, but that shouldn't effect 64-bit binaries. The 64-bit
binaries only show a few warnings for late load dependencies on my end that
wont cause a problem. The only way I can see the error you were receiving
coming up would be if you were using 32-bit Java on either Windows 32 or 64 bit.
Original comment by a...@1stleg.com
on 20 May 2014 at 5:23
- Changed state: Accepted
Attachments:
GoogleCodeExporter commented
I can verify the same issue on Windows XP (32-bit) due to libgcc_s_sjlj-1.dll.
I will look into some better math to accomplish the same result.
Original comment by a...@1stleg.com
on 20 May 2014 at 8:45
- Changed state: Started
GoogleCodeExporter commented
Should be resolved as of
https://github.com/kwhat/jnativehook/commit/398b92a5be9afba9be934d03b2009b37f8e7
4ca3
The problem is came down to gcc's c99 bit int implementation not being static
linked when it should be. I have added an explicit flag to gcc to force the
static linking of libgcc but I am not sure how that will effect non-gcc
targets. Ideally the -static-libgcc flag should be included as an overridable
option in the jnitasks project when compiling with GCC on Windows.
I have attached a nightly that includes the fix. Please test and reopen if it
is sill a problem.
Original comment by a...@1stleg.com
on 21 May 2014 at 7:24
- Changed state: Fixed
Attachments: