我试图用JIntellitype听全局热键加载JIntellitype.dll但我得到这个错误:无法从本地文件系统或从内部JAR
Exception in thread "main" com.melloware.jintellitype.JIntellitypeException: Could not load JIntellitype.dll from local file system or from inside JAR at com.melloware.jintellitype.JIntellitype.(JIntellitype.java:114) at com.melloware.jintellitype.JIntellitype.getInstance(JIntellitype.java:177) at utils.HotKey.(HotKey.java:19) at ui.Main.Catch_Hotkeys(Main.java:78) at ui.Main.(Main.java:20) at ui.Main.main(Main.java:15) Caused by: java.io.IOException: FromJarToFileSystem could not load DLL: com/melloware/jintellitype/JIntellitype.dll at com.melloware.jintellitype.JIntellitype.fromJarToFs(JIntellitype.java:150) at com.melloware.jintellitype.JIntellitype.(JIntellitype.java:105) ... 5 more Caused by: java.lang.NullPointerException at com.melloware.jintellitype.JIntellitype.fromJarToFs(JIntellitype.java:146) ... 6 more
我已加载的jar文件,我也通过引用库指向dll所在的文件夹。
这里是代码我试图运行:
import com.melloware.jintellitype.HotkeyListener;
import com.melloware.jintellitype.IntellitypeListener;
import com.melloware.jintellitype.JIntellitype;
public class HotKey extends Thread implements HotkeyListener, IntellitypeListener {
private final int CTRL_C_SHIFT = 10;
public HotKey()
{
JIntellitype.getInstance().unregisterHotKey(CTRL_C_SHIFT);
JIntellitype.getInstance().registerHotKey(CTRL_C_SHIFT, JIntellitype.MOD_CONTROL + (int)'C', JIntellitype.MOD_SHIFT);
if (!JIntellitype.isJIntellitypeSupported())
{
System.exit(1);
}
}
@Override
public void onIntellitype(int arg0)
{
}
@Override
public void onHotKey(int key)
{
if (key == CTRL_C_SHIFT)
{
System.out.println("smg");
}
}
}
任何想法如何解决这一问题?
此外,在第1种情况下,即使选择哪一个,也应该将dll文件名更改为“JIntellitype.dll”。 –