Importing EJB JAR files

You can import beans and other metadata from an EJB JAR file into a new or existing EJB project.
Tip: The following paragraph applies to Windows. You can quickly drag and drop an EJB JAR file from the Windows® Explorer or desktop onto the Project Explorer view. If you drop on an existing EJB module, the wizard will add the EJB JAR as a referenced JAR.

To import an EJB JAR file into an EJB project using the Import wizard:

  1. In the J2EE perspective, click File > Import > EJB JAR file and click Next.
  2. In the EJB JAR file combination box, enter the location and name of the EJB JAR file that you want to import. You can click the Browse button to select the JAR file from the file system.
  3. In the EJB project combination box, select an EJB project from the drop-down list.
  4. In the Target runtime drop-down list, select the application server that you want to target for your development. This selection affects the run time settings by modifying the class path entries for the project.
  5. Optional: To add the new module to an enterprise application (EAR) project, select the Add module to an EAR application check box. In the EAR application combination box, type a new project name or select an existing enterprise application project from the drop-down list. Or, click the New button to launch the New Enterprise 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.
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 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 will contain 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 will be a single archive which contains the merged contents of the Java output folder of the EJB project and the xxx.imported_classes folder.

Related concepts
Annotation-based programming overview
Related tasks
Creating EJB projects
Exporting EJB projects to EJB JAR files
Importing class files to EJB projects

Feedback