访问Windows注册表 [英] Accessing Windows Registry

查看:183
本文介绍了访问Windows注册表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

使用Java读取/写入Windows注册表





<我需要从Java访问Windows注册表。此外,我需要复制一些注册表项,可能必须使用Java输入新的注册表变量..
有人帮我请...

I need to access Windows registry from Java.. Also I need to copy some registry entries and may have to enter new registry variables using Java.. some one help me please...

推荐答案

我推荐 Java Native Access(JNA)库。它是JNI的一个非常好的包装器。根据这个邮件列表帖子,他们已经有一个围绕本机Windows注册表函数调用的贡献包装器。

I'd recommend the Java Native Access (JNA) library. It's a pretty nice wrapper around JNI. According to this mailing list post, they've already got a contributed wrapper around the native Windows registry function calls.

如果将JNA库添加到项目中,您需要的相关来源是Registry.java类。从那里,只需调用该类的方法来调查Windows注册表。

If you add the JNA libraries to your project, the relevant source you'll want is the Registry.java class. From there, just call methods on that class to investigate the Windows registry.

作为旁注,请确保在使用JNA时使用Platform.isXxx()确保您的代码可以实际查询特定平台上的注册表。

As a side note, make sure when you use JNA that you use Platform.isXxx() to make sure your code can actually query the registry on the particular platform.

这篇关于访问Windows注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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