Importing EJB JAR files

You can import beans and other metadata from an EJB JAR file into a new or existing EJB project.

About this task

Tip: The following paragraph applies to Windows. You can quickly drag an EJB JAR file from the Windows Explorer or desktop onto the Enterprise Explorer view. If you drop on an existing EJB module, the wizard adds the EJB JAR as a referenced JAR.

Procedure

  1. In the Enterprise Explorer view of the Java™ EE perspective, select File > Import.
  2. Under Select an import source, click EJB > EJB JAR file and click Next.
  3. In the EJB JAR file field, enter the location and name of the EJB JAR file that you want to import.
  4. In the EJB Project field, type a new project name or select an EJB project from the drop-down list.
  5. In the Target runtime drop-down list, select the application server that you want to target for your development. If no Target servers exist, create one using the New button. The target server choice affects the run time settings by modifying the class path entries for the project. This selection affects the run time settings by modifying the class path entries for the project.
  6. Optional: Select the Add project to an EAR 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 combination box. Or, click the New button to launch the New Enterprise Application Project wizard. Click Next.
  7. Click Finish to import the EJB JAR file.

Results

Note: The .ser files in an EJB 1.0 JAR are converted into the ejb-jar.xml file for EJB 1.1 during an import.

Imported .class files

You can also import an EJB JAR file that contains binary .class files only, with no source code. The beans can be mapped, and deployment code can be generated, or new enterprise beans that depend on the contents of the JAR can be created.

A folder called xxx.imported_classes contains only .class files. All other files (for example, source files and .properties files) are copied to the source folder of the EJB project during import. This strategy allows the EJB tools to reflect the shape of the binary Java classes, in order to map, assemble, and deploy the imported JAR file.

On an EJB JAR export, the contents of the xxx.imported_classes folder are merged into the resulting EJB JAR. That is, the exported JAR file is a single archive which contains the merged contents of the Java output folder of the EJB project and the xxx.imported_classes folder.


Feedback