尝试编译此https://github.com/kwhat/jnativehook/wiki/Compiling
直到我必须运行ant all to build的步骤。
在命令提示符中使用以下命令进行编译失败。
[javac] Fatal Error: Unable to find package java.lang in classpath or bootcl
asspath
BUILD FAILED
C:\Users\George\Downloads\sounds\JNativeHook-2.0.1\JNativeHook\build.xml:394: Co
mpile failed; see the compiler error output for details.
Total time: 0 seconds
编辑:我刚刚将rt文件复制到我正在尝试编译的目录中。我遇到了第一个错误,但现在我正在接受
ava\org\jnativehook\mouse\NativeMouseWheelListener.java
download-libuiohook:
bootstrap-libuiohook:
[echo] Bootstrapping libUIOHook...
[autoreconf] autoreconf --verbose --force --install
BUILD FAILED
C:\Users\George\Downloads\sounds\JNativeHook-2.0.1\JNativeHook\build.xml:351: Ex
ecute failed: java.io.IOException: Cannot run program "sh" (in directory "C:\Use
rs\George\Downloads\sounds\JNativeHook-2.0.1\JNativeHook\src\libuiohook"): Creat
eProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)
at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Jav
a13CommandLauncher.java:58)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:428)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:442)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:629)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:670)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:496)
at org.jnitasks.autotools.AutoreconfTask.execute(AutoreconfTask.java:113
)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.Main.runBuild(Main.java:853)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find th
e file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
at java.lang.ProcessImpl.start(ProcessImpl.java:137)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 24 more
Total time: 1 second
仍在努力尝试同时解决这个问题。
更新
我想我一直在犯这个错误。我尝试在MINGW64中做这个,这可能就是我应该这样做的。
可悲的是,我仍在调查我的错误。
compile-java:
[echo] Compiling Java source...
download-libuiohook:
bootstrap-libuiohook:
[echo] Bootstrapping libUIOHook...
[autoreconf] autoreconf --verbose --force --install
[autoreconf] autoreconf: Entering directory `.'
[autoreconf] autoreconf: configure.ac: not using Gettext
[autoreconf] autoreconf: running: aclocal --force -I m4
[autoreconf] aclocal-1.15: error: aclocal: file '/msys64/usr/share/aclocal/xsize .m4' does not exist
[autoreconf] autoreconf: aclocal failed with exit status: 1
BUILD FAILED
C:\Users\George\Downloads\sounds\JNativeHook-2.0.1\JNativeHook\build.xml:351: ex ec returned: 1
Total time: 2 seconds
更新:
哇所以msys64有多少shell。我现在尝试了似乎是最后和最后的shell msys2_shell.bat,它进一步得到了但仍然失败了。
现在我
JNativeHook/bin --enable-debug --enable-quiet --enable-static --disable-shared --with-pic
[configure] checking build system type... x86_64-pc-msys
[configure] checking host system type... x86_64-pc-msys
[configure] checking target system type... x86_64-pc-msys
[configure] checking for a BSD-compatible install... /usr/bin/install -c
[configure] checking whether build environment is sane... yes
[configure] checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
[configure] checking for gawk... gawk
[configure] checking whether make sets $(MAKE)... yes
[configure] checking whether make supports nested variables... yes
[configure] checking for style of include used by make... GNU
[configure] checking for gcc... clang
[configure] configure: error: in `/c/Users/George/Downloads/sounds/JNativeHook-2.0.1/JNativeHook/bin/libuiohook':
[configure] checking whether the C compiler works... no
[configure] configure: error: C compiler cannot create executables
[configure] See `config.log' for more details
BUILD FAILED
C:\Users\George\Downloads\sounds\JNativeHook-2.0.1\JNativeHook\build.xml:361: exec returned: 77
Total time: 37 seconds
如此接近。
更新:
安装了clang,现在从config.log文件中获取此详细错误。
configure:3580: checking whether the C compiler works
configure:3602: clang -march=armv6j -mfpu=vfp -mfloat-abi=hard -Os -g -pipe -fomit-frame-pointer -flto -ffat-lto-objects -fno-stack-protector -Wl,--as-needed,-O1 -flto conftest.c >&5
clang.exe: warning: optimization flag '-ffat-lto-objects' is not supported
clang.exe: error: 'i686-pc-windows-gnu': unable to pass LLVM bit-code files to linker
configure:3606: $? = 1
configure:3644: result: no
configure: failed program was
答案 0 :(得分:0)
好的,对于未来的JNativeHook编译器,像我这样在Windows 8.1上执行此操作的新手是我必须要做的才能使其工作。
除了在他们的git上提供的编译for windows部分中的所有步骤之外。
你还需要......
下载适用于Windows的LLVM。 将rt.jar复制到JNativeHook目录中。 并确保绝对确保您已删除因失败的构建而生成的任何build.properties。
这应该让它发挥作用。
答案 1 :(得分:0)
如果您正在尝试编译2.0.1,请不要忘记运行 ant distclean
首先。我忘记在zip文件的排除列表中包含build.properties文件,从而破坏了包过程。我认为这也将解决你的rt.jar复制问题。它可能会解决您的所有问题;)无论如何,2.0.2将解决问题,并计划在周日发布。