Over a million developers have joined DZone.
Platinum Partner

Eclipse Global Preferences

· Java Zone

The Java Zone is brought to you in partnership with ZeroTurnaround. Discover how you can skip the build and redeploy process by using JRebel by ZeroTurnaround.

Rate This

Eclipse is good, but like any other tool: it gets better after I have it customized for my special needs. Eclipse stores a lot of settings in the workspace, see my article about Copy my workspace settings. But is there a way to apply some settings to every workspace? At least to the new ones? Because importing/exporting the settings can get really tedious as I have many workspace.  And indeed, there are global settings in eclipse. And I want to have them changed…

Warning: changing eclipse global preferences might break an eclipse installation. So better have a backup of the changed files at hand!

I’m using here the eclipse based CodeWarrior for MCU10.2, but things are pretty much the same for any eclipse based product (see the documentation in Defining your own global preferences).

Question: where are the global preferences stored? The first thing to check is the eclipse\configuration\.settings folder: Here some plugins store their global preferences. For example: the recent workspace settings are in org.eclipse.ui.ide.prefs.

#Fri Apr 06 16:46:14 CEST 2012

But what about all the other settings? Looking at the CodeWarrior installation, inside the eclipse folder, I find the cwide.ini file.

cwide.ini file

cwide.ini file

This file defines the eclipse startup options for launching the IDE (cwide.exe for CodeWarrior). The interesting part is this line:


This tells eclipse to use the cwide.properties as a default configuration file. If I inspect that file, it has the following content:


OK, that gives me an idea how settings could look like. But the question is: how to know the settings and syntax? What works (most of the time) is following approach:

  1. Launch eclipse with a new workspace
  2. Export the settings using File > Export > General > Preferences to a file
  3. Change the setting in Window > Preferences
  4. Export the settings using File > Export > General > Preferences  to a different file
  5. Compare/Inspect the exported information and find the settings
  6. Apply the settings to the cwide.properties file, without the /instance/ part
  7. Restart the IDE and check if it works with a new workspace

The last check is necessary as not all settings might work that way, see this forum post.

This is maybe best illustrated with an example. I have configured my workspace to use 2 for tab width and to insert spaces for tabs:

Changed Preferences for Tabs

Changed Preferences for Tabs

If I compare the two exported .epf files, this gives me:

Diffing Eclipse Preference Files

Diffing Eclipse Preference Files

That means the two following lines are configuring what I have changed:


For the cwide.properties file I need to cut off the /instance/ part, so I have this added to the cwide.properties:

# Set tab width to 2
# Using spaces for tabs

Note: Preferences are applied in following order: global preferences, then local (workspace) preferences

This does NOT overwrite an existing setting of my workspace. As I can see from above diff, my initial workspace settings do not have any settings for tabWidth and spacesForTabs. Creating a new workspace use and apply my new settings. But once I have the them, they will not be overwritten with new global ones. Which makes sense: the local settings are winning.

Note: Post a comment if you know an elegant way how to enforce/overwrite workspace settings with global ones.

The Java Zone is brought to you in partnership with ZeroTurnaround. Discover how you can skip the build and redeploy process by using JRebel by ZeroTurnaround.


Published at DZone with permission of Erich Styger , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}