![]() |
| ||
| Print Registry Folder Contents Hello, I need to print the contents of a Windows Registry folder (Display Names). I have posted what I have started with and would appreciate some help. It returns a null value at this point, even though there are items in this folder. Thank you. import java.lang.reflect.Method; |
| ||
| Re: Print Registry Folder Contents OK, no other answers, so I'll have a go. This is coding on wild side! You use refection to break into private methods that are not part of the public API. Even if you get this to work now, there's no guarantee that it won't break in the very next minor Java update. Seems dangerous to me. Anyway, try it without the HKEY_LOCAL_MACHINE\\ in your key, I think that's already implied by systemRoot. If you want a safer way to approach this, you can use ProcessBuilder to run the command line registry tool reg.exe, and stick to published public APIs. I can let you have some sample code if you want to try it. |
| ||
| Re: Print Registry Folder Contents James, I am really new to accessing the Registry, so some sample code would be very helpful. Thank you for your recommendations. I will try them out. Thanks again :) |
| ||
| Re: Print Registry Folder Contents This may be useful to you: http://javabyexample.wisdomplug.com/...y-wrapper.html |
| ||
| Re: Print Registry Folder Contents Here's a small program that will query a value from the registry. It runs reg.exe with the appropriate command then parses the out pt to get the result. If you look at the help messages for reg.exe you'll see the other options, and you'll then need to add some parsing to get whatever other results you need. The only other options I've ever found are (1) a neat Java/dll package called LatteLib that works well, but seems to have vanished from the net a couple of years ago, and (2) very many variants on the code that hooks into the private methods of the Java Windows Preferences implementation (with the dangers that I mentionsed in my earlier post). Anyway, here's some code that may be useful to you: import java.io.BufferedReader; |
| All times are GMT -4. The time now is 10:53 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC