I'm trying to use Java Preferences from XML WITHOUT using Windows registry, but I see a Registry-related message

不问归期 提交于 2019-12-12 02:34:55

问题


I have a simplified program that produces the following output, in which the lines starting with ^ are generated by my code. Note that I deliberately deleted the Prefs key in HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft.

^ A preferences file was found
Aug 09, 2013 2:45:23 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002.
Windows RegCreateKeyEx(...) returned error code 5.
^ doallunconditionally: false
^ footnotespopup: false
^ thumbnailsgenerated: true
^ thumbnailwidth: 200
^ pathin: C:/Users/Das/Google Drive
^ pathout: C:/Users/Das/ottmar/site
^ pathlog: C:/Users/Das/ottmar/logs

My question is, can I bypass the registry entirely? I thought I should be able to.
I can post the source code (180 lines) if needed.


回答1:


I eventually discovered a workaround (not a solution) to this problem. As I stated before, I had inadvertently/foolishly deleted the Prefs node in Software\JavaSoft in the Registry, and when I recreated it the message went away.

I now assume that the Windows registry is used whether you like it or not.




回答2:


This page explains how to use a preferences store apart from the Windows registry:

http://www.davidc.net/programming/java/java-preferences-using-file-backing-store

I've not tried it but it seems to be fairly straightforward. You can also checkout:

Is there a way to use java.util.Preferences under Windows without it using the Registry as the backend?



来源:https://stackoverflow.com/questions/18161576/im-trying-to-use-java-preferences-from-xml-without-using-windows-registry-but

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!