0

I need to get all folders from registry paths
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall and HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall and to change the Displayname of the selected by user value to for example displayname1. Is that possible with java? never worked with registry before and dont wanna spoil something. thnx.

hollopost
  • 569
  • 9
  • 28

1 Answers1

1

You can use java.util.prefs.Preferences

Preferences p = Preferences.userRoot(); for user preferences and Preferences p = Preferences.systemRoot(); for system preferences

and then accessing each path

if(p.nodeExists("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall") {
    p = p.node("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall");

}
Ulises
  • 9,115
  • 2
  • 30
  • 27
  • will this list all subfolders of Uninstal? and how to change dispalyname when user select 1 of them? – Гринюк Андрей Apr 12 '16 at 18:13
  • I just dont wanna try it all myself w/o being sure that this wont break anything. i can write all code w/o blocks where to get data from registry and change it if u want. its not a problem. its only i never worked with registry before. – Гринюк Андрей Apr 12 '16 at 18:17
  • You'll get a Preferences object where each node exists. So basically yes, if there are other nodes under Uninstall you'll get them. Then after that you can modify and retrieve whatever you want. Look at the methods of java.util.prefs.Preferences. Do you need to change node names? or preferences names? – Ulises Apr 12 '16 at 18:59
  • i ll try to figure out how to do this. probably i need pref name for selected node – Гринюк Андрей Apr 12 '16 at 20:00
  • can u give me a link where to read about changing registry values with preferences. found something but about saving user preferences only. nothing about registry changes so far – Гринюк Андрей Apr 12 '16 at 20:55
  • 1
    I don't know why this answer is selected as solution. It does not work. – dominic.e Jun 07 '19 at 09:54
  • @Ulises You can't access arbitrary keys with Preferences. This code doesn't work. – grzegorz Feb 02 '21 at 18:41