This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Looking up the System registry from java application

 
marys joseph
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I would like to look up system's registry, how can I do that in java?

thanks,
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My system has no registry.

I don't know, why we have a linux and mac forum, but no windows forum.
Perhaps to few windows-users

Perhaps File registry = new File ("/path/to/registry"); ?
 
savas karabuz
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

AFAIK there is no standart Java API to access Windows registry. You can develop your own JNI wrappers, or use available open-source implementations.

You can go through the following web page :

jRegistry Key

Hope this helps...
[ May 26, 2004: Message edited by: savas karabuz ]
 
marys joseph
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your replies.

I downloaded jregistry but I am unable to follow the user requirements. I kept jregistry.jar in the class path. and .dll file in c:\windows\system32

Still I can not import import ca.beq.util.win32.registry.*;

what am I doing wrong? If anyone is using jregistry please let me know,
 
savas karabuz
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again,

It's definitely a classpath issue, you can put jRegistryKey.jar in jre\lib\ext folder under your java home directory (C:\j2sdk1.4.2_04\jre\lib\ext on my machine, for example), jRegistryKey.dll can be put anywhere on Windows'PATH (system32 folder is OK). Here is a sample program i have tried and seen working which i copied from jRegistryKey Users Manual.

import ca.beq.util.win32.registry.*;
import java.util.*;

public class AccessRegistry {
public static void main(String[] args) {
RegistryKey r = new RegistryKey(RootKey.HKEY_CURRENT_USER, "Software");
if(r.hasSubkeys()) {
Iterator i = r.subkeys();
while(i.hasNext()) {
RegistryKey x = (RegistryKey)i.next();
System.out.println(x.toString());
} // while
} // if
}
}

Hope this helps...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic