Windows 7中的Java首选项存储在哪里? [英] Where are the Java preferences stored in Windows 7?

查看:58
本文介绍了Windows 7中的Java首选项存储在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在某些应用程序中使用了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_MACHINE \ SOFTWARE \ JavaSoft \ Prefs

但是我在那里看不到.

让它更奇怪的是,当我运行此应用程序时:

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.

编辑#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_USER \ Software \ JavaSoft \ Prefs

这篇关于Windows 7中的Java首选项存储在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆