blob: 6ed26a734b35a984f170194cfd495aa16b19efd4 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- /*******************************************************************************
* Copyright (c) 2000, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/ -->
<link rel="stylesheet" type="text/css" href="../../org.eclipse.wst.doc.user/common.css" />
<title>Specifying target servers for J2EE projects</title>
</head>
<body id="tjtargetserver"><a name="tjtargetserver"><!-- --></a>
<h1 class="topictitle1">Specifying target servers for J2EE projects</h1>
<div><div>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.</div><div class="section"><p>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.</p>
<p>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, one
of those servers must be the preferred server, the server that will contribute
to the project's class path.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<div class="note"><span class="notetitle">Note:</span> Utility Java projects
that are added to an application are targeted to the same target server as
the application. Web library projects that are added to a Web project are
targeted to the same target server as the Web project.</div>
<p>To modify
the target runtime and default server for an existing project:</p>
</div>
<ol><li class="stepexpand"><span>In the Project Explorer view of the J2EE perspective, right-click
the enterprise application or module project, and select <span class="uicontrol">Properties</span> from
the pop-up menu.</span> The Properties dialog for the project opens.</li>
<li class="stepexpand"><span>Select the <span class="uicontrol">Project Facets</span> page on the Properties
dialog.</span></li>
<li class="stepexpand"><span>Click the <span class="uicontrol">Add/Remove Project Facets</span> button.</span></li>
<li class="stepexpand"><span>In the Select Project Facets window, click the <span class="uicontrol">Show
Runtimes</span> button.</span> The <span class="uicontrol">Runtimes</span> list
shows all of the runtimes in your workspace. The grayed-out runtimes are not
compatible with the currently selected project facets. The runtime in bold,
if there is one, is the preferred runtime for the project.</li>
<li class="stepexpand"><span>In the <span class="uicontrol">Runtimes</span> list, select the check boxes
next to the runtimes you want to develop the project for.</span> The runtimes
you select filter the list of available facets in the <span class="uicontrol">Project Facet</span> list.<p>If
you select any runtimes for the project, you must make one of those runtimes
the preferred runtime for the project. If you select only one runtime from
the list, that runtime is automatically made the preferred runtime.</p>
</li>
<li class="stepexpand"><span>To select the preferred runtime, click on a runtime and then click
the <span class="uicontrol">Make Preferred</span> button.</span> The preferred
runtime is shown in bold text.</li>
<li class="stepexpand"><span>Click <span class="uicontrol">Finish</span>.</span></li>
<li class="stepexpand"><span>Click <span class="uicontrol">OK</span>.</span></li>
</ol>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="../topics/ph-projects.html" title="The workbench can work with many different types of projects. The following topics cover creating and managing some of the types of projects related to J2EE development.">Working with projects</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="../topics/cjarch.html" title="The Java 2 Platform, Enterprise Edition (J2EE) provides a standard for developing multitier, enterprise services.">J2EE architecture</a></div>
</div>
</div></body>
</html>