我尝试修改Win7注册表。在IDEA我没有错误,但是当我使用控制台时,我有UnsatisfiedLinkError异常:
Exception in Thread main java.lang.UnsatisfiedLinkError: com.sun.deploy.association.utility.WinRegistryWrapper.RegOpenKey(ILjava/lang/String;I)[I at com.sun.deploy.association.utility.WinRegistryWrapper.RegOpenKey(Native Method) at
com.sun.deploy.association.utility.WinRegistryWrapper.WinRegSetValueEx(UnknownSource) at MainClass.main(MainClass.java:13)
码
import com.sun.deploy.association.utility.WinRegistryWrapper;
public class MainClass {
public static void main (String[] args) throws InterruptedException {
while(true){
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
WinRegistryWrapper.WinRegSetValueEx(WinRegistryWrapper.HKEY_CURRENT_USER, "Keyboard Layout\\Toggle", "Hotkey" , "2");
WinRegistryWrapper.WinRegSetValueEx(WinRegistryWrapper.HKEY_CURRENT_USER, "Keyboard Layout\\Toggle", "Language Hotkey" , "2");
WinRegistryWrapper.WinRegSetValueEx(WinRegistryWrapper.HKEY_CURRENT_USER, "Keyboard Layout\\Toggle", "Layout Hotkey" , "1");
}
}
}