Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Registry API Error - Invalid Handle in using com.ice.jni.registry package

807589Feb 18 2008 — edited Sep 1 2008
Hi all,

I'm trying to access the Windows Registry through java using the ice registry package com.ice.jni.registry.
I'm getting this error:

*com.ice.jni.registry.RegistryException: Registry API Error 6, 'invalid handle' -
'RegQueryValueEx()'*

My code is as follows:
import java.util.*;
import com.ice.jni.registry.*;

class regSearch
{
	public static void main(String[] s)
	{
		System.loadLibrary("ICE_JNIRegistry");
		RegistryKey oRegKey = new RegistryKey(4,
		"\\HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Management\\ARPCache");
		//"\\HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall");
		
		String str = oRegKey.getFullName();
		
		System.out.println(str);
		
		try 
		{
			System.out.println(oRegKey.hasDefaultValue());
			//Enumeration keyElements = oRegKey.keyElements();
		
		//	System.out.println(keyElements.nextElement());
		} 
		catch (RegistryException e) 
		{
			// TODO Auto-generated catch block
			System.out.println("You are getting an error: \n"+e);
		}
	}
}
I'm trying to fetch information about softwares that are currently installed on the PC. But I'm getting this error right now..so I can't go ahead. Please help me for the same..I've got to finish this by today..

Thanx in advance,
Rave.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 29 2008
Added on Feb 18 2008
3 comments
308 views