Majid Laissi
Majid Laissi

Reputation: 19808

preference file location

I have the following code:

Preferences prefs = Preferences.userRoot().node("c:/test.txt");
System.out.println(prefs.get("aa", "not found"));
prefs.put("aa", "bb");

which works fine (the first time it shows "not found" and after it shows "bb").

But I can't find my test.txt file.

Any idea where it is ?

Upvotes: 1

Views: 667

Answers (1)

nikis
nikis

Reputation: 11254

Java Preferences are not stored in files (to do that you should dump them manually using OutputStream - Preferences.exportNode(OutputStream stream);). On Windows they are stored under HKEY_CURRENT_USER\Software\JavaSoft\Prefs. So there you will find node "c:\" and node "test.txt" under it.

Upvotes: 2

Related Questions