Eclipse Tips

These tips relate to Eclipse 2.x, 3.x & 4.x series

Eclipse 2.x

Workbench Key Bindings

The configurations for key bindings are held in a plugin.xml files for the ui. These are in the eclipse/plugins/org.eclipse.jdt.ukx.x.x and eclipse/plugins/org.eclipse.uix.x.x directories.

The set has a configurationId, e.g. configurationId="org.eclipse.ui.emacsAcceleratorConfiguration"

Each set defines keys for actions, e.g. This is the entry for the Emacs binding to Content Assist.

<accelerator key="Alt+/" id="org.eclipse.jdt.ui.edit.text.java.content.assist.proposals" />

For some reason this particular key combination isn't picked up by the editor when using the Emacs key bindings. Appears to be a bug.

Ant - java.lang.NoSuchMethodError

If you're getting the following error trying to run ant tasks from within Eclipse, one cause is having changed the Ant runtime preferences.

  • BUILD FAILED: java.lang.NoSuchMethodError: org.apache.xerces.xni.parser.XMLComponent.getFeatureDefault(Ljava/lang/String;)Ljava/lang/Boolean;

This is most likely to be occurring because two different versions of xerces are on the classpath.

If you set ANTHOME in the Ant runtime preferences (Window->Preferences->Ant->Runtime) Eclipse changes the Ant jars on the runtime classpath. This no doubt causes class-loading conflicts with xerces within the Eclipse jvm which has probably loaded a different version of xerces before running Ant. I would think the Eclipse Ant plug-in must be the same version of Ant as you set ANTHOME to.

The easiest fix is to select 'Restore Defaults' in the Ant preferences dialog box. You may need to re-add any jars to the runtime classpath, such as junit.jar.

Ant - Class missing from classpath

Probably can't find either junit.jar or ant-junit.jar. Both are required.

Check what's listed under the ANT_HOME classpath in preferences (Window->Preferences->Ant->Runtime). Both jars should be there. For some reason in 3.2.2, junit.jar is missing. I fixed this simply by clicking 'Ant Home...' and selecting a normal full Apache Ant distribution instead.

Eclipse 3.x

JVM maxmimum memory

If you've a moderately sized project, you may need to modify the startup parameters go give eclipse more memory. If you're using the Sun JVM, modify the startup parameters similar to the following (depending where you've installed eclipse). -Xmx increases the maximum memory from the 256Mb default, -XX:MaxPermSize increases the permanent generation memory space from the 64Mb default.

  • /usr/bin/eclipse -vmargs -Xmx512M -XX:MaxPermSize128m=

You might also like to be specific about which JVM it uses:

  • /usr/bin/eclipse -vm /opt/java/jdk1.5.0_09/bin/java -vmargs -Xmx512M

-- Frank Dean - 06 Dec 2006

Subversion Plug-in (Subversive)

Add the remote site as:

http://www.polarion.org/projects/subversive/download/1.1/update-site/

You should only need: * SVN Team Provider 1.1.7 * SVNKit 1.1.4 Implementation (Optional) 1.1.7

After startup, you will need to change the default SVN Client under Window | Preferences... | Team | SVN | SVN Client to

  • SVN Kit (SVNKit 1.1.4 (http://svnkit.com/) r3248)

Subversive Plug-in for Eclipse 3.3.2 (Europa) Edition

The process for installing Subversive has changed with two separate update sites now required. The instructions at this time are as follows:

  1. Select 'Help->Software Updates->Find and install...' from the Main Menu
  2. Select 'Search for new features to install'
  3. Select 'New Remote Site...'
  4. Enter the site name as 'SVN Connectors'
  5. Enter the URL as http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/
  6. Select 'New Remote Site...'
  7. Select 'OK'
  8. Enter the site name as 'Subversive plug-in'
  9. Enter the URL as http://download.eclipse.org/technology/subversive/0.7/update-site/
  10. Select 'OK'
  11. Select 'Finish'
  12. Under the 'Subversive plug-in' branch, select 'Subversive SVN Team Provider Plugin (Incubation)'
  13. Under the 'SVN Connectors' branch, select 'SVNKit 1.1.7 Implementation (Optional) 2.1.0.I20090213-1500'
  14. Click the 'Select Required' button
  15. Click 'Next' etc. etc. then Finish

-- Frank Dean - 08 Apr 2009

Generating Ant Build Files

An Ant script can be created with the eclipse2ant plugin, which has been available in Eclipse since version 3.1M6.

Select File->Export from the main menu, then select Ant Buildfiles under the General section.

Any custom files in the project's root directory will be included in the build file if they have the <?eclipse.ant.import?> element as the first child.

See the example user build file

Git Plug-In

See also:

-- Frank Dean - 23 Jun 2012

Enabling Automatic Keyword Substitution

To automatically set the svn:keywords properties for newly create files, go to Windows | Preferences... | Team | SVN | Properties Configuration | Automatic Properties

  1. Click the 'Add' button
  2. Enter a file name template, e.g. *.java
  3. Enter a property setting, e.g. svn:keywordsAuthor Date Id Revision HeadURL=
  4. Click 'OK'

JBoss IDE

This has now been replaced by the JBossTools project. See http://labs.jboss.com/wiki/JBossTools

Add the remote site as:

http://download.jboss.org/jbosside/updates/stable

XML Editors

Install WTP using the update manager in Eclipse. (BTW I eventually gave up trying to get this working With Eclipse 3.2.2 and installed the JEE bundle version 3.3.x which includes WTP). If the web tool options are not showing up under preferences, check that you're using at least Java 1.5.

Add the "Web Tools Platform (WTP) Update Site" http://download.eclipse.org/webtools/updates/

Enable search under the Callisto Discovery Site as it contains dependencies for WTP

Choose Eclipse XML Editors and Tools under Web Tools Platform, and if necessary, click the 'Select Required' button. Getting around the conflicting inter dependencies is challenging. You can try selecting everything then un-selecting those items that your don't want.

The required features appear to be:

  • Callisto Discovery Site
    • Graphical Editors and Frameworks
      • Graphical Editing Framework
    • Models and Model Development
      • Eclipse Modeling Framework (EMF) Runtime + End-User Tools
      • XML Schema Infoset Model (XSD) Runtime _ End-User Tools
  • Web Tools Platform (WTP) Updates
    • Enabling Features
      • WST Common UI
    • Web Tools Platform (WTP)
      • Eclipse XML Editors and Tools

Also:

Show Hexadecimal Values in Debug

Select 'Display hexadecimal values (byte, short, char, int, long)' under Window->Preferences->Java->Debug->Primitive Display Options

Enabling Assertions for Unit Testing

Under Window -> preferences -> Java -> JUnit - Enable assertions for new JUnit launch configurations. Don't forget to delete any existing launch configurations.

-- Frank Dean - 29 Sep 2012


-- Frank Dean - 30 Sep 2003

Related Topics: DevelopmentSetup, EclipsePlugins, EGitTips