This week's book giveaway is in the Agile forum.
We're giving away four copies of Head First Agile and have Andrew Stellman & Jennifer Greene on-line!
See this thread for details.
Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Where do I look for the preference file?  RSS feed

 
Roger Wells
Ranch Hand
Posts: 51
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following code and it seems to work.
Where can I see the preference file? I have looked in both the system library and user library and can't
find it. 

It dose print out all of the println statements when I press the hello world button

Maybe I don't know what I am looking for?

 
Stephan van Hulst
Saloon Keeper
Posts: 7821
142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what does your application print?
 
Norm Radder
Ranch Foreman
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where can I see the preference file? 

From the API doc:
This data is stored persistently in an implementation-dependent backing store


On my Windows10 system, the store is the system registry.  Here is an export of the registry's contents:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\JavaSoft\Prefs\/Preference/Example]
"/A"="a"
"/B"="b"
"/C"="c"
 
Roger Wells
Ranch Hand
Posts: 51
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the pringln output

1
2 User Preference Node: /
3
4
Node's absolute path: /PreferenceExample


I am running on a Mac

Thanks
Roger
 
Norm Radder
Ranch Foreman
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, no ideas about where it would be on  a Mac.

The posted code tested the put() method.  Have you now tried the get() method to see if the data can be read?
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The preferences files generated by the Preferences API are named com.apple.java.util.prefs. The user’s preferences file is stored in their home directory (~/Library/Preferences/). The system preferences are stored in /Library/Preferences/ and are only persisted to disk if the user is an administrator


https://developer.apple.com/library/content/documentation/Java/Conceptual/Java14Development/05-CoreJavaAPIs/CoreJavaAPIs.html#//apple%5Fref/doc/uid/TP40001902-210728-TPXREF143
 
Roger Wells
Ranch Hand
Posts: 51
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks with your help I found the file.

Roger
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!