Where does Eclipse store preferences?

JavaEclipseFormattingEclipse RcpSettings

Java Problem Overview


When I change a setting in a window like in the screenshot below, where are those settings actually stored?

Bonus: Is there any way, using Java, Eclipse RCP etc, to access the settings programmatically?

Thanks!

Eclipse Preferences

Java Solutions


Solution 1 - Java

Source : Eclipse wiki

If you want to keep preferences from one version to the other, export them using File/Export/Preferences.

Preferences are stored in various places (this applies to Eclipse 3.1)

for each installation (but this may vary for multi-user installations), in files stored in: <eclipse_home>/eclipse/configuration/.settings/

There is typically one file per plugin, with a prefs extension. Note that very few plug-ins use installation-wide preferences.

for each workspace, in files stored in <workspace>/.metadata/.plugins/org.eclipse.core.runtime/.settings .

There is typically one file per plugin, with a prefs extension. for each project --for project-level settings -- in files stored in a .settings sub-directory of your project folder.

Here's the article to access preferences using java code.

Solution 2 - Java

The preferences are stored in prefs files in the workspace at .metadata/.plugins/org.eclipse.core.runtime/.settings. There is one prefs-file for each plugin contributing preferences.

The programmatical access to the entire preferences is done with IPreferencesService the which you may obtain using Platform.getPreferencesService().

You may find more information and examples on how to use them in the Runtime preferences Eclipse help page.

Solution 3 - Java

Search for it:

Change some setting in Eclipse then run:

find ~  -type f -mmin -5 | grep "\.settings"

This will discover files modified in last 5 minutes.

Mine was in workspace, literally...

~/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs

Solution 4 - Java

You can see most of the relevant eclipse settings (mainly for JDT) in the saneclipse project from Lars Vogel.

See the vogellacompany/com.vogella.saneclipse repo, which will tweak and fine-tune the settings of:

com.vogella.saneclipse.preferences/.settings/org.eclipse.jdt.core.prefs
com.vogella.saneclipse.preferences/.settings/org.eclipse.core.runtime.prefs
com.vogella.saneclipse.preferences/.settings/org.eclipse.core.resources.prefs
com.vogella.saneclipse.templates/.settings/org.eclipse.jdt.core.prefs
com.vogella.saneclipse.fileextensions/.settings/org.eclipse.jdt.core.prefs
com.vogella.saneclipse.fileextensions/.settings/org.eclipse.pde.core.prefs

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCodyBugsteinView Question on Stackoverflow
Solution 1 - JavaOptionalView Answer on Stackoverflow
Solution 2 - JavapellatonView Answer on Stackoverflow
Solution 3 - JavaKrisWebDevView Answer on Stackoverflow
Solution 4 - JavaVonCView Answer on Stackoverflow