blob: 28ac71f5ee9110abead19c82a5c5ed392b662479 [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.wtp.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><p>When you develop J2EE applications, the workbench requires that
you 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.</p>
<div class="section"><p>In order to support different application servers that use different
JDK levels for their Java™ Runtime Environment (JRE), the workbench
requires that projects include a target server setting. 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 requiring that you specify a target server, the workbench
enforces that proper entries are appropriately added for running on the server
you choose.</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 .runtime file in the project's resources.
You should not edit this file manually.</p>
<p>All J2EE project creation and
import wizards require 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">Server</span> page on the Properties
dialog.</span></li>
<li class="stepexpand"><span>In the <span class="uicontrol">Target runtime</span> drop-down list, select
the server runtime that you want your project to be developed for. This selection
impacts the runtime libraries that are added to your project class path. You
can click <span class="uicontrol">New</span> to define a new runtime environment that
you have installed. The list of runtime environments are defined in your workbench
preferences.</span></li>
<li class="stepexpand"><strong>Optional: </strong><span>Enterprise applications only: When modifying
the target server for an enterprise application, you can select the <span class="uicontrol">Include
child projects</span> check box to apply your changes to any children
modules.</span> This ensures that the enterprise application project
and all of its module projects, utility projects, and Web application library
projects have the same target server.</li>
<li class="stepexpand"><strong>Optional: </strong><span>In the <span class="uicontrol">Default server</span> field,
select a default server to use when deploying the project. Although you would
typically set this to the same value as the target runtime, the <span class="uicontrol">Default
server</span> selection is independent of the <span class="uicontrol">Target runtime</span> selection.
The default server simply specifies a project preference so you are not prompted
for available runtime environments when you deploy the project.</span></li>
<li class="stepexpand"><span>Click <span class="uicontrol">Apply</span> to save your changes.</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>