Creating EJB projects

An EJB project is used to organize the resources contained in an EJB module.

An EJB module is used to assemble one or more enterprise beans into a single deployable unit. It is deployed in a standard Java™ archive (JAR) file. An EJB module can be used as a standalone application, or it can be combined with other modules to create a J2EE enterprise application. An EJB module is installed and run in an enterprise bean container. An EJB project must be referenced by an enterprise application project (defined as a module in an EAR) in order to be deployed successfully and run on a server.

An EJB module contains the following:

To create a new EJB project:

  1. In the J2EE perspective, select File > New > EJB Project. The New EJB Project wizard opens.
  2. In the Name field, type a name for the EJB project. To change the default Project location, click the Browse button to select a new location.

    If you specify a non-default project location that is already being used by another project, the project creation will fail.

  3. In the Target runtime drop-down list, select the application server that you want to target for your development. Or, create a new target runtime using the New button. The target runtime selection affects the compilation and runtime settings by modifying the class path entries for the project.
  4. Optional: Select a pre-defined project configuration from the Configurations drop-down list.
  5. Optional: Select the Add module to an EAR application check box to add the new module to an enterprise application (EAR) project. Type a new project name or select an existing enterprise application project from the drop-down list in the EAR Project Name combination box. Or, click New to launch the New EAR Application Project wizard.
    Note: If you type a new EAR project name, the EAR project will be created in the default location with the lowest compatible J2EE version based on the version of the project being created. If you want to specify a different version or a different location for the enterprise application, you must use the New Enterprise Application Project wizard.
  6. Click Next.
  7. Optional: Select one or more project facets from the Project Facets list. To specify server runtimes, click Show Runtimes and select one or more runtimes. After making your selections, you can save your custom configuration by clicking Save. Click Next.
  8. In the Source Folder field, specify a folder for your source files or accept the default value.
  9. Optional: Select the Create an EJB Client JAR Project to hold the client interfaces and classes check box if you want the client interface classes for your enterprise beans to be kept in a separate EJB client JAR file. This EJB client JAR file will be added to the enterprise application as a project utility JAR file. Specify values for the Name and Client JAR URI fields, or accept the defaults.
  10. Click Finish.
Related concepts
Annotation-based programming overview
Related tasks
Exporting EJB projects to EJB JAR files
Importing EJB JAR files
Importing class files to EJB projects

Feedback