The IDE Java Development Tools (JDT) include the appropriate components to compile a program. An AST parser is exposed to help the code manipulation. Compilation is generally defined in two steps : analysis and synthesis. The AST is the analyzed version of a program organized as a tree connecting declarations and definitions. A specific API called the Java model provides an abstraction layer for the AST. The C Development Tools (CDT) also include an AST parser.
With such informations, the IDE is in Java able to perform complex operations on the code design. Functions exposed in the refactor menu take advantage of the Eclipse AST parser.
The compilation performed using the Eclipse AST is reliable. Since tomcat 5.5, it is used by the Jasper engine to compile JSPs as servlets. This is why, since this version, the servlet container does not require any longer a JDK to run.
You should be careful when compiling with Eclipse : there are a few differences when compiling with the JDK (especially on generics transtyping).