user3258301
user3258301

Reputation: 51

Trying to use Preferences in java but need admin rights (need to work on windows and MAC)

I am trying to save some settings for my program.

I am for instance asking the user to pick a folder when the program is run for the first time.

this is all working and wonderfull, but it does not get saved.

prefs = Preferences.userRoot().node(this.getClass().getName());

Returns with WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.

error code 5 (access denied)

How do i ask for admin rights? both on windows and mac, thank you for your time!

Upvotes: 2

Views: 362

Answers (1)

user3258301
user3258301

Reputation: 51

I actually found out when using userRoot(), that the program indeed makes the key. It just throws a warning because java tries to make it in systemRoot() aswell, just incase you ever need it in systemroot. When you are using userRoot() you never will.

Upvotes: 1

Related Questions