User Tools

Site Tools


eclipse:java

Setting the JRE

  1. “Window” → “Preferences”
  2. In dialog “Preferences”
    1. “Installed JREs” → “Execution Environment”
    2. Select the JRE / JDK that Eclipse should use by default

Eclipse preferences JRE

Handling static imports

Note: I found this in an article on Stack Overflow: Handling static imports with Eclipse) It is so useful that I copied it so that it won't get lost.

When working with JUnit and Hamcrest matchers one often has to add static imports. Eclipse can assist you, but it is not 100% automatic (as with regular imports).

In order for Eclipse to suggest static imports you have to list them under “Favorites”.

Under “Preferences → Java → Editor → Content Assist → Favorites” you can add a list of static imports that you want Eclipse to suggest.

If you use JUnit and Hamcrest then add the following:

org.hamcrest.Matchers.*
org.hamcrest.CoreMatchers.*
org.junit.*
org.junit.Assert.*
org.junit.Assume.*
org.junit.matchers.JUnitMatchers.*

The “.*” in the end will be added by Eclipse automatically, so don't enter it.

Maven integration

Trouble shooting

Maven dependencies not deployed on Tomcat

Most likely you do not have the M2Eclipse WTP plugin installed. Note that it is not necessarily installed when you take M2Eclipse from the marketplace.

Check the update site:

M2Eclipse WTP - http://download.jboss.org/jbosstools/updates/m2eclipse-wtp/
eclipse/java.txt · Last modified: 2015/05/17 17:44 (external edit)