Friday, June 5, 2009

Read/Write windows registry entries using Java

In one of my application , where I had to read/write entries on windows registry using Java. These are the two jar files which I found extermely useful.

Windows Registry Wrapper

This help us to read/write REG_DWORD and REG_BINARY also.

Below is a sample code I used with the jar file

import at.*;
import at.jta.*;

public static void main(String[] args) throws RegistryErrorException
{

Regor obj = new Regor();
Key key = obj.openKey(Regor.HKEY_CURRENT_USER, "Software\\Custom Writer");
int count = 0;
count = Integer.parseInt(obj.readDword(key, "StartAt"));

}

Java Registry Wrapper

The source code and .jar files are available in the google code store. (http://www.snipcode.org/java/1-java/23-java-class-for-accessing-reading-and-writing-from-windows-registry.html)

This will help us to read/write the REG_SZ (registry string characters)


Some other helpful links:

http://www.kodejava.org/examples/236.html
http://www.scribd.com/doc/429547/Registry-Disassembled-a-Basic-Tutorial
http://www.programmerworld.net/win/registry.htm

No comments:

Post a Comment