When you develop J2EE applications, you can specify the server runtime environments for your J2EE projects. The target server is specified during project creation and import, and it can be changed in the project properties. The target server setting is the default mechanism for setting the class path for J2EE projects.
In order to support different application servers that use different JDK levels for their Java™ Runtime Environment (JRE), the workbench prompts you for a target server setting for each J2EE project. For example, if you want to take advantage of the features of JDK 1.4.2, your applications require different class path entries than those that were used in previous versions of the workbench. By prompting you to specify a target server, the workbench enforces that proper entries are added for running on the server you choose.
You can also add more than one target server for your project. In this case, the workbench prevents you from adding any facets not supported by all of the target servers. If you add more than one target server, choose a server that will contribute to the project's class path as the primary server.
When the project is created, the class path of the project is updated with two class path containers. One container is the JDK container and the other is the server container. The JDK container points to the directory that contains the JAR files that are necessary to support the JDK version. The server container points to the directory that contains the multiple public JAR files available in the selected server. The project then compiles based on the required JAR files located in these folders, and you do not need to worry about adding additional JAR files from the server during development. When the project is compiled, the JAR files are included in the class path. You can still add your own JAR files to the class path.
The target runtime environment is specified in the org.eclipse.wst.common.project.facet.core.xml file in the project's .settings folder. You should not edit this file manually; instead, use the properties window as described in this topic.
All J2EE project creation and import wizards prompt you to specify the target server for the resulting projects. The list of target servers that you can choose from is filtered based on installed runtimes, the J2EE level of the application, and the J2EE module type. For example, for EJB projects only application servers that support Enterprise JavaBeans™ are displayed. All projects inside a single EAR file must be targeted to the same server. If you create a new project and add it to an existing EAR project during creation, the project inherits the target server setting of the EAR project.
To modify the target runtime and default server for an existing project, complete the following steps: