• Home → Products

JNDI provider for Windows Registry JNDI2R

JNDI2R is a JNDI service provider to Windows registry. It provides JNDI API and supports serialized Java classes in registry. JNDI2R works on Windows XP/2000/NT/Me/9x and JDK1.3/JDK1.4.

JNDI2r works using JNI – through Windows DLL library written in C++ it accesses Windows registry:

Basic schema of JNDI provider for Windows registry jndi2r

The sample JNDIregedit shows basic usage of jndi2reg library. Just unpack JNDIregedit archive, and start run.bat. This .BAT file adds path to WinRegistry.dll and starts RegEdit.jar — a class implementing the demo app that is working with registry through JNDI provider jndi2r.jar.

Registry Editor

The following sample code demonstrates it's basic usage:

    public static void main(String args[]) {
        try {
            Hashtable env = new Hashtable();

            Context c = new InitialContext(env);

            // registry entry name, i.e. "HKCU\Software\MyProduct\Version"
            String entryName = args[0];
            // entry value, i.e. "1.0"
            String entryValue = args[1];

            // bind will create registry entry with specified value
            c.bind(entryName, entryValue);

        } catch (NamingException e) {

For more information please see the documentation and API sections. Binaries with demo applications with source code and documentation can be downloaded here. To obtain a registered version, please proceed to download section.