利用register.jar读取注册表信息

1. 需要在jre/bin下加入文件ICE_JNIRegistry.dll</span>
2. 需要registry.jar 
3.下载地址: http://www.trustice.com/java/jnireg/index.shtml
<pre name="code" class="java">import java.util.Enumeration;

import com.ice.jni.registry.NoSuchValueException;
import com.ice.jni.registry.Registry;
import com.ice.jni.registry.RegistryException;
import com.ice.jni.registry.RegistryKey;

public class RegisterRead {

	public static void main(String[] args) {
		RegistryKey registryKey = Registry
				.openSubkey(Registry.HKEY_LOCAL_MACHINE, "SOFTWARE",
						RegistryKey.ACCESS_ALL);

		try {
			registryKey = registryKey.openSubKey("kingsoft");
			Enumeration ele = registryKey.keyElements();
			while (ele.hasMoreElements()) {
				Object key = ele.nextElement();
				System.out.println(key);
			}
			// RegistryValue registryValue = registryKey. (String.valueOf(key));
			// // 获得该该key对应的值
			// String result = new String(registryValue.getByteData())
			// .toString();
			// System.out.println(result);
		} catch (NoSuchValueException e) {
			e.printStackTrace();
		} catch (RegistryException e) {
			e.printStackTrace();
		}
	}

}


 
 
 

你可能感兴趣的:(利用register.jar读取注册表信息)