Configuring a Java EE Runtime Library

If you are using Eclipse with the Java EE tools installed, the Java compiler is not able to resolve references to the Java EE APIs unless a target Java EE runtime environment is configured.

Follow these steps to configure the Java EE Runtime Library:

  1. To open the Eclipse preferences, go to Window > Preferences.
  2. In the Preferences pane, select the Server > Runtime Environments item.
    Figure 1. Server Runtime Environments pane
    Server Runtime Environments pane
  3. Click Add. Select IBM and the appropriate WebSphere Application Server for the target application server. The choices available depend on the WebSphere Developer Tools or Rational Application Developer features you have installed.
  4. On the next wizard pages, configure your installed server location or install a new Liberty server.
  5. Alternatively, click Add. Select Basic > J2EE Runtime Library.
  6. On the next wizard page, click Browse to choose the library location, locate the dev/JavaEE folder of your WebSphere Application Server installation, and select the appropriate Java EE version. That folder contains the j2ee.jar file with the Java EE APIs.

To use this runtime library in a web or EJB project when you have the IBM WebSphere Application Server Developer Tools installed, target the WebSphere Application Server traditional or Liberty server.

If WebSphere Application Server Developer Tools are not installed, you can set the library as a targeted runtime in the project properties. In the Project view, right-click the project, and select Properties. Select Targeted Runtimes, then select the recently configured Java EE runtime library, and click OK.
Figure 2. Targeted Runtimes
Targeted Runtimes pane