Read/write to Windows registry using Java

前端 未结 24 2054
日久生厌
日久生厌 2020-11-21 05:45

How is it possible to read/write to the Windows registry using Java?

24条回答
  •  萌比男神i
    2020-11-21 06:11

    Yes, using the java.util.Preferences API, since the Windows implementation of it uses the Registry as a backend.

    In the end it depends on what you're wanting to do: storing preferences for your app is what the Preferences does just great. If you're wanting to actually change registry keys not having to do with your app, you'll need some JNI app, as described by Mark (shameless steal here):

    From a quick google: Check the WinPack for JNIWrapper. It has full Windows Registry access support including Reading and Writing.

    The WinPack Demo has Registry Viewer implemented as an example.

    Check at http://www.teamdev.com/jniwrapper/winpack/#registry_access

    And...

    There is also try JNIRegistry @ http://www.trustice.com/java/jnireg/

    There is also the option of invoking an external app, which is responsible for reading / writing the registry.

提交回复
热议问题