math4tots
math4tots

Reputation: 8869

Java persistence with java.util.prefs.Preferences

It seems as though I can save some user preferences using java.util.prefs.Preferences. The preferences are tied to the specific classes -- I get a Preferences instance by passing a class Object to some static method, e.g. Preferences.userNodeForPackage.

However, what happens if I delete my class and never use it anymore? What happens to the stored data? Is it just going to leak memory in my harddrive? Is there some nice way I can browse through my current Preferences data?

Upvotes: 1

Views: 895

Answers (1)

MadProgrammer
MadProgrammer

Reputation: 347332

This data is stored persistently in an implementation-dependent backing store

Generally speaking, yes. If you simply delete the project that created the preferences, it's likely that these preferences will remain.

You best choice is to try and provide some kind of "uninstall" that would have the ability/knowledge to remove the keys used by the application.

Upvotes: 2

Related Questions