# Defining the server runtime environments preferences

Using the Preferences page, you can direct the workbench to use a specific runtime environment of an application server for compiling, testing, or running your application.

A server runtime environment is composed of the following definitions:

- a name to identify the server runtime environment
- the type of server that specifies the vendor and version-level of the server
- the directory path to a local installation of the server
- in some cases, also includes a reference to a Java runtime environment

If a server runtime environment is referencing a stub directory of the server, you can only compile your application against the stub server. However, if referencing a full installation of the server, you can compile, test, and run your application against the installation of the server.
To define a server runtime environment, complete the following steps:

1. From the Window menu, select Preferences.
2. In the Preferences window, expand the Server folder and then select Runtime Environments. The Server Runtime Environments section of the Preferences dialog is displayed.
3. Optional: Click the Search button. This searches your local directory for server runtime environments. Searching on a remote host is not supported.
   1. The Search for Runtime Environments dialog box opens. In the Folder field, browse or type the directory where you would like the workbench to start searching for server runtime environments. Click OK.
   2. If a list of installations is displayed, select the desired target server and click OK in the displayed dialog; then click OK in the Preferences dialog. If no installations of any application servers are found, continue completing the steps for this task.
4. Click Add. The New Server Runtime Environments wizard opens.
   1. Under the Select the type of runtime environment list, select a server and version level as the target server runtime environment.
      Tip: In the text field under the Select the type of runtime environment label, you can replace the text `type filter text` with keywords to filter the list of available application servers. The following are examples of filter keywords:
      `Apache`
        Filters the list of available servers where the vendor is Apache
      `WebSphere`
        Filters the list of available servers where the name is WebSphere
      `ejb`
        Filters the list of available servers that support ejb modules.
      `web`
        Filters the list of available servers that support Web modules
      `5.0`
        Filters the list of available servers that are at version, 5.0 or supports JEE 5 specification level.
      `1.2`
        Filters the list of available servers that supports J2EE 1.2 specification level or any servers that may have a version-level of 1.2.
   2. When you add a server runtime environment, by default a server is created and added as an entry in the Servers view. If you want to only add the server runtime environment and not create the server in the Servers view, clear the Create a new local server check box.
   3. Click Next. A panel for the server is displayed.
   4. For Installation directory or Location field, type or browse to the location of the target server.
      Tip: If you specify a false location for the target server, use the workbench to assemble modules and then use the application server to deploy the modules.
      If you selected the target server as J2EE Runtime Library (a generic J2EE container), specify a directory that contains `.jar` files such a `\bin\lib` directory for a Java™ developer kit (JDK) installation.
   5. Click Finish. The target server name and type is added to the table in the Server Runtime Environment section.
   6. In the Preferences dialog, click OK.

To change the list of available target servers, click Window > Preferences > Server > Runtime Environments to go to the Server Runtime Environments section of the Preferences dialog. Use the Add, Edit, Remove or Search options to change the list of target servers as needed.

To change the target server for a module:

1. Right-click on the module in the Project Explorer view and click Properties > Project Facets. The Project Facets page opens.
2. Select the Runtimes tab.
3. Under the Runtimes table, select the target servers for the module.

Parent topic: Defining server preferences