0

I've never worked with the registry before and it seems a bit intimidating, as I know very little about it . I need to asses if any Blackberry emulators are installed, and get their location if found. I searched manually from regedit and found entries under HKEY_LOCAL_MACHINE -> SOFTWARE -> Research In Motion -> BlackBerry Device Simulators -> 5.0.0.423 -> 9700. Here, 5.0.0.423 is a version of the emulator and 9700 is a specific device. When clicking on the device name (9700) I can see some values, one of which is of interest to me:

Value name=InstallDir
Value data: C:\Program Files\Research In Motion\BlackBerry Smartphone Simulators 5.0.0\5.0.0.423 (9700)\

I need to use Java, targeting both 32 and 64 bit Windows systems and search if any emulators were installed, then save their names (such as 9700) and their location (C:\Program Files...) in a property file or whatever.

From what I read, it looks like I need to use the Preference class in java.util.prefs, however it looks like I can only access some part of the registry with it. I do not need to write anything, just read values. Is there anything you can suggest?

Thank you, Alex

alex
  • 477
  • 2
  • 7
  • 17
  • 1
    The registry is a Windows only thing. Java was designed to run on multiple OS-es, so directly accessing Windows' registry with Java is not possible. By "directly" I mean some built-in Java functionality. If you're only using it on Windows, why not use a language like C#? – Bart Kiers Apr 09 '10 at 13:06
  • Please use the search function more: http://stackoverflow.com/questions/62289/read-write-to-windows-registry-using-java – Lajcik Apr 09 '10 at 13:07
  • 1
    I am aware of the search function and I did looked at the JNI suggestion. There's more to my question. I see posted examples of how to search for a known value. I am looking for something that may or may not be there and I need to loop through a set of values. – alex Apr 09 '10 at 13:52

1 Answers1

0

have a look at http://lenkite.blogspot.com/2008/05/access-windows-registry-using-java.html - there is some sample code there you should be able to use.

chris
  • 9,745
  • 1
  • 27
  • 27