Java 有人知道如何使用JNI注册表(com.ice.JNI.registry)为一个键设置默认注册表值吗?
我目前正试图通过Java应用程序查询和设置一些windows注册表项。我们被授权使用JNI注册库(出于许可原因)。要设置的键和值不在我的控制之下(我正在修改其他第三方应用程序设置的值) 我可以获取并设置正常键和值的各种条目和值OK,我可以查询键OK的默认值。但是,我需要知道如何设置键的默认值Java 有人知道如何使用JNI注册表(com.ice.JNI.registry)为一个键设置默认注册表值吗?,java,registry,Java,Registry,我目前正试图通过Java应用程序查询和设置一些windows注册表项。我们被授权使用JNI注册库(出于许可原因)。要设置的键和值不在我的控制之下(我正在修改其他第三方应用程序设置的值) 我可以获取并设置正常键和值的各种条目和值OK,我可以查询键OK的默认值。但是,我需要知道如何设置键的默认值 //This works final RegistryKey regKey = Registry.HKEY_LOCAL_MACHINE.openSubKey("SOFTWARE\\company\\app\
//This works
final RegistryKey regKey = Registry.HKEY_LOCAL_MACHINE.openSubKey("SOFTWARE\\company\\app\\subkey", RegistryKey.ACCESS_ALL);
RegStringValue blah = (RegStringValue) regKey.getValue("blah");
if (blah == null) {
blah = new RegStringValue(regKey, "blah");
}
blah.setData("Some data");
regKey.setValue(blah);
//Not sure about this...
final RegistryKey regKey = Registry.HKEY_LOCAL_MACHINE.openSubKey("SOFTWARE\\company\\app\\subkey", RegistryKey.ACCESS_ALL);
String defaultValue = regKey.getDefaultValue(); //Gets the default value OK
//How do I reset it, though???
//need something like:
// regKey.setDefaultValue("Some new value");
//The following does not seem to work
RegDWordValue defVal = (RegDWordValue) regKey.getValue(""); //Also tried ...getValue("Default")
defVal.setData("Some new Value");
regKey.setValue(defVal);
regKey.closeKey();
有人知道这是否可能吗?是的,这是可能的
在c#中,对于任何键,您都可以
key.SetValue("", "value");
无名键是默认键
记录在:(第页存档)
我知道有点晚了。不过,希望它能帮助别人。我也在找同样的东西