I initially thought that reading windows registry in java would be a piece of cake and then happily coded the following lines.
package com.ns;
import java.util.prefs.Preferences;
public class RegistryReader {
public static String KEY;
public static void main(String [] args) {
KEY = "HKEY_LOCAL_MACHINE/SOFTWARE/MySQL AB/MySQL Server 5.0/Location";
Preferences sysPref = Preferences.systemRoot();
System.out.println(sysPref.get(KEY, "Null"));
}
}
In the hope of retrieving the path where mysql is installed, I ran the above code, but it prints "Null". When I did a google search I found many third party jars that would aid in reading the registry.
My question is why a very common task like reading windows registry, does not have a simple api in java ? Also if there is no option other than to use third party software, then which one will be a better choice (the one that is reliable and examples of Read/Write registry can be found easily).
regards,
nirvan.