Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Java Preferences - accessing system node in Windows(How do I coax Windows 10 to let me read/write the system node to the Windows registry?)
Java Preferences - accessing system node in Windows [message #1796709] Thu, 18 October 2018 00:44 Go to next message
Reinhardt Christiansen is currently offline Reinhardt ChristiansenFriend
Messages: 73
Registered: March 2010
Member

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.
Re: Java Preferences - accessing system node in Windows [message #1796750 is a reply to message #1796709] Thu, 18 October 2018 12:33 Go to previous messageGo to next message
Eclipse UserFriend
I'd write to the system root. I'd also maintain a user preference as to whether they have tried changing such a preference and if non, first prompt them to prepare them that they will have to authorize the change.
Re: Java Preferences - accessing system node in Windows [message #1796881 is a reply to message #1796750] Sat, 20 October 2018 16:36 Go to previous message
Reinhardt Christiansen is currently offline Reinhardt ChristiansenFriend
Messages: 73
Registered: March 2010
Member
Thanks, Brian, for your reply.

My problem is that I get Windows security errors whenever I try to read or write to the system root. Any idea how I can get past those?

The only way I know of is to execute from a command prompt that is running in Administrator mode. That's not going to cut it for integration testing let alone production. I have to believe there is a way to satisfy Windows while still running in Eclipse. Do you happen to know what that way is? Anyone?
Previous Topic:Starting scheduled job on server
Next Topic:How do I create a JUnit5 Test Suite in Eclipse?
Goto Forum:
  


Current Time: Thu Apr 25 20:59:04 GMT 2024

Powered by FUDForum. Page generated in 0.02851 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top