Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling on Windows #1

Closed
tomzx opened this issue Dec 27, 2013 · 2 comments
Closed

Compiling on Windows #1

tomzx opened this issue Dec 27, 2013 · 2 comments

Comments

@tomzx
Copy link

tomzx commented Dec 27, 2013

Hi,

I'm assuming you decided to move from https://code.google.com/p/jnativehook/ to here?

I'm currently trying to compile jNativeHook on Windows in order to try to debug the "known" issue (in 1.1.4) where after a while the hook decides not to work anymore. Interestingly enough, when it decides to break, global shortcuts such as F2 to rename files don't work anymore (as well as right-clicking on a file and using the rename option, which is pretty weird...)

I haven't been able to build using the ant build files, thus I'm wondering on what platform you're primarily working and if it is a mistake on my part or it is simply that Windows isn't supported at the moment?

@kwhat
Copy link
Owner

kwhat commented Dec 27, 2013

Hi,

Yes, I got fed up with Google's buggy git hosting so I migrated to github for the time being. I will probably mirror the repository back at some point in the near future.

Let me give you a little background regarding the current project structure. I have separated out JNativeHook into two projects; The java/jni portion is still under jnativehook and all of the platform-related code to make it function is in libuiohook. (https://github.com/kwhat/libuiohook) The primary reason for doing this was to make some of the more difficult bugs easier to debug, including the one you mentioned. There are a couple of demo programs included in libuiohook that can be used as an entry point to test and debug the dll it produces.

On to compiling. All supported platforms should compile without issue, however the toolchain setup is a bit different. For Windows you will need to install MSYS2 from http://sourceforge.net/p/msys2/wiki/MSYS2%20installation/ to c:\msys[2|64]. I prefer using ConEMU (http://sourceforge.net/projects/conemu/) with the settings >> startup script set to "path C:\msys64\bin;%path% && sh.exe" instead of the built in msys2_shell.bat, however both will work fine. After you install MSYS2 run pacman -Sy followed by pacman -S autoconf automake-wrapper mingw-w64-x86_64-gcc gcc mingw-w64-x86_64-libtool libtool make pkg-config That should install all of the required dependencies except for ant. Install that as you normally would along with a JDK and make sure your JDK_HOME or JAVA_HOME environment variable is pointing to the correct path.

Calling ant compile jar on JNativeHook should just "work" after that. The src code for libuiohook and JNITasks will be pulled in and compiled automatically. If you are going to do some debugging, I would suggest patching the JNativeHook build.xml file around line 335 and adding demo to the task to build the above mentioned demo programs. This will allow you to debug the native portion of the code without stepping around the JVM in the debugger.

One more note. I did a bit of work on autotools for libuiohook last night and it looks like I managed to break compiling on Windows. If you are seeing "error: cannot find input file: `pc/uiohook.pc.in'", roll back to the previous revision of libuiohook until I have an opportunity to fix it. If you ever asked yourself if you should learn/use autotools, don't. It's not worth it, not if it was the last build system on Earth and you needed to compile a program to save the planet. If you run into any other problems feel free to contact me directly or on irc.freenode.net #jnativehook.

@dmrzh dmrzh mentioned this issue Aug 9, 2014
@kwhat
Copy link
Owner

kwhat commented Aug 13, 2014

This should be fixed. If it is still an issue, please reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants