Exporting EJB projects to EJB JAR files

After you have tested your enterprise beans, you can export the module into an EJB JAR file.

When you export an EJB module, or project, the contents of the project are exported into an EJB JAR file regardless of whether deployment code has been generated or not. You can use the exported server-side JAR file as the client JAR file, since it contains all of the required code from both a server-side and client-side perspective.

Important: If you use the Export EJB JAR file wizard to export an EJB project, the export wizard does not include an EJB project's associated EJB client JAR project. To include the EJB client JAR file, it is recommended that you export the enterprise application EAR file that contains the EJB project. The resulting EAR file will include any dependent EJB client JAR files as utility JAR files. Alternatively, you can remove the EJB client JAR file before exporting the EJB project, or export the EJB client JAR project separately as a JAR file. Another option for a team environment is to export the projects together. See Exporting projects for sharing.

This process for exporting an EJB project to a JAR file is not meant to be a project sharing mechanism. If you want to share projects, see Sharing Projects.

To export an EJB project:

  1. In the Project Explorer view of the J2EE perspective, right-click the EJB module that you want to export.

  2. Select Export > EJB JAR file from the pop-up menu. The Export wizard opens.

    Note: If this EJB project was previously imported, and there is an imported_classes folder (or an imported_classes.jar file from an unmigrated project), these imported classes will be merged back into the exported JAR file. All of the resources in the Java output folder ("bin") are included in the EJB JAR.

  3. In the Destination field, enter the full path and JAR file name where you want to export the EJB module that is selected in the EJB project field.

  4. Optional: To export source files, select the Export source files check box.

  5. Optional: If you are exporting to an existing JAR file and you do not want to be warned about overwriting it, select Overwrite existing files without warning

  6. Click Finish.

To deploy your EJB JAR file to an application server after you export it, you need to use the deployment tools provided by the vendor of that server.

 

Related concepts

Annotation-based programming overview

 

Related tasks

Creating an EJB project
Importing an EJB JAR file
Importing class files to an EJB project