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.