Eclipse: tips and tricks

eclipse -vmargs -Xmx512M

  • Configure Eclipse to Use a JDK, not a JRE. Via Ben Pryor.

Window -> Preference -> Java -> Installed JREs

and make sure that the default (checked) JRE points to your JDK installation

  • Use Multiple Workspaces Effectively. Via Ben Pryor.

eclipse -data c:\myworkspace -showlocation

The -data parameter directs Eclipse to use the “c:\myworkspace” directory on the local machine as the workspace directory. The -showlocation parameter shows the workspace location in the Eclipse title bar – very helpful when running multiple Eclipse instances at the same time.

One note – don’t waste time setting your preferences in each workspace you create. Simply use the Import and Export options under the file menu to export preference from one workspace you’ve already set up into new workspaces you create.

  • Avoid tab indentation when editing source code:

Windows -> Preferences -> Java -> Code Style -> Format

Click Edit… button in the right panel

Change the tab policy to “Spaces only” in the Indentation tab

After that you can do a re-format (Ctrl + Shift + Spaces) of all the source code to change all tabs to spaces