|Java Preferences - accessing system node in Windows [message #1796709]
||Thu, 18 October 2018 00:44
| Reinhardt Christiansen
Registered: March 2010
I'm back working on Java for the first time in quite a while - several years - and I'm having some problems with an old program that uses Java Preferences.
My program is looking for the system node for Preferences and, if not found, it wants to write some defaults to that node. I get authorization errors from Windows when I try to read or write the system node. (I can read or write a user node just fine.)
The only way I've been able to read and write the system node is if I run my program in a command prompt as an administrator. While that is workable for testing, it's not very convenient. I'm trying to develop in Eclipse and I'd like to be able to run/debug my program there without having to invoke a command prompt. Also, I ultimately want to be able to run my program on the desktop, most likely from a jar.
My problem apparently stems from changes made in Windows UAC back when Vista came out. I wrote the program on an XP machine and hadn't executed it on a later Windows until the other day, which explains why this hasn't bitten me sooner.
I imagine Java developers have long ago developed strategies for dealing with this situation. I hope someone can share those strategies with me. I'd be grateful if you can help!
I think of Preferences as something that most people will use and know something about but maybe I'm wrong about that. Are people not using the Preference classes any more to store and get Preferences? If there's another (better?) way to store preferences, I'm fine with that. I'm definitely open to the idea of handling Preferences differently. As I said at the beginning of this post, I've been away from Java for a while and other techniques may have evolved in the meantime.
So let me open this up. I'd like to have a default set of Preferences that is obtained from *somewhere* and I'd like each user to be able to store and then change those preferences at will. How would YOU accomplish that if your program required it?
I'm game to write it to an external database or use XML or any of a number of different approaches.
I *thought* the Preferences classes would be most peoples' first choice and posted here to find out how people used the system node in a Windows environment - in other words, how did they gain access to the system node when testing in Eclipse and then executing the tested program in a jar or other environments - but if the Preference classes are NOT the way most people do things, please tell me at least one way that people ARE using.
Powered by FUDForum
. Page generated in 0.01239 seconds