Where are the Java preferences stored in Windows 7?(Java 首选项存储在 Windows 7 中的什么位置?)
问题描述
我们在某些应用程序中使用 Java 首选项,但并没有真正注意到这一点,因为进行调用的实用程序相当陈旧,并且是在 Windows XP 时代编写的.但似乎 Java 首选项不再存储在 Windows 7 的注册表中 - 或者它们存储在不同的地方.
We use the Java preferences in some of our apps and haven't really noticed this since the utility that makes the calls is fairly old and was written in Windows XP days. But it seems the Java preferences are no longer stored in the registry in Windows 7 - or they are stored somewhere different.
我期待它出现在:
HKEY_LOCAL_MACHINESOFTWAREJavaSoftPrefs
但我没有看到它.
让它更奇怪的是,当我运行这个应用程序时:
What makes it wierder, is that when I run this app:
public static void main( final String[] args ) throws BackingStoreException {
Preferences systemRoot = Preferences.systemRoot();
Preferences preferences = systemRoot.node( "com/mycompany/settings" );
systemRoot.put( "foo", "bar" );
systemRoot.put( "baz", "lolz" );
System.out.println( "-------------------------------" );
String[] keys = preferences.keys();
for( String key : keys ) {
System.out.println( key );
}
System.out.println( "-------------------------------" );
keys = systemRoot.keys();
for( String key : keys ) {
System.out.println( key );
}
}
它实际上会写入(我可以注释掉并再次运行它并且它可以工作)但我没有在注册表中看到新键.
It actually writes (I can comment the put out and run it again and it works) but I don't see the new keys in the registry.
另外,我似乎无法在任何地方看到此文档.提前致谢.
Also, I can't seem to see this documented anywhere. Thanks in advance.
EDIT #1 这很重要的唯一原因是设置的变化取决于它运行的环境.话虽如此,通过手动插入注册表项然后进行一些检查来模拟该环境通常很有用.
EDIT #1 The only reason this matters is that the setting changes dependent upon which environment it is ran. This being said, it is often useful to simulate that environment by inserting the registry keys manually and then doing some checking.
我以管理员身份运行,但我没有在注册表中看到我期望的键.
I was running as admin, yet I did not see the keys in the registry where I expected them to be.
推荐答案
它们在当前用户下:HKEY_CURRENT_USERSoftwareJavaSoftPrefs
这篇关于Java 首选项存储在 Windows 7 中的什么位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Java 首选项存储在 Windows 7 中的什么位置?
基础教程推荐
- Java:带有char数组的println给出乱码 2022-01-01
- 降序排序:Java Map 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01