To expound on darioo’s answer with a concrete example. Tomcat 7 installed using homebrew on OS X, using Eclipse:
- Right click your project folder, select Properties at the bottom of the context menu.
- Select “Java Build Path”
- Click Libraries” tab
- Click “Add Library…” button on right (about halfway down)
- Select “Server Runtime” click “Next”
- Select your Tomcat version from the list
- Click Finish
What? No Tomcat version is listed even though you have it installed via homebrew??
- Switch to the Java EE perspective (top right)
- In the “Window” menu select “Show View” -> “Servers”
- In the Servers tab (typically at bottom) right click and select “New > Server”
- Add the path to the homebrew tomcat installation in the dialog/wizard (something like: /usr/local/Cellar/tomcat/7.0.14/libexec)