| <!DOCTYPE html |
| PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html lang="en-us" xml:lang="en-us"> |
| <head> |
| <link rel="stylesheet" type="text/css" href="../../org.eclipse.wst.doc.user/common.css" /> |
| <title>Importing an EJB JAR file</title> |
| </head> |
| <body id="teimp"><a name="teimp"><!-- --></a> |
| |
| <h1 class="topictitle1">Importing an EJB JAR file</h1> |
| <div><p>You can import beans and other metadata from an EJB JAR file into |
| a new or existing EJB project.</p><div class="skipspace"> <div class="tip"><span class="tiptitle">Tip: </span>In the Project Explorer view you can also copy |
| enterprise beans by dragging and dropping them from one EJB project to another |
| EJB project. The import wizard will open to help you merge existing enterprise |
| beans.</div> |
| <div class="tip"><span class="tiptitle">Tip: </span><img src="../images/ycwin.gif" alt="The following paragraph applies to Windows." /> You can quickly drag and drop an EJB JAR file from the Windows<sup>®</sup> Explorer |
| or desktop onto the Project Explorer view. The Import wizard will open with |
| appropriate fields already populated. If you drop on an existing EJB module, |
| the wizard will import into that EJB module. If you drop on an enterprise |
| application, the wizard will bind the new EJB module to this EAR.</div> |
| <p>To |
| import an EJB JAR file into an EJB project using the Import wizard:</p> |
| </div> |
| <ol><li class="skipspace"><span>In the J2EE perspective, click <span class="menucascade"><span class="uicontrol">File</span> > <span class="uicontrol">Import</span> > <span class="uicontrol">EJB JAR file</span></span> and |
| click <span class="uicontrol">Next</span>.</span></li> |
| <li class="skipspace"><span>In the <span class="uicontrol">EJB JAR file</span> combination box, enter |
| the location and name of the EJB JAR file that you want to import. You can |
| click the <span class="uicontrol">Browse</span> button to select the |
| JAR file from the file system.</span></li> |
| <li class="skipspace"><span>In the <span class="uicontrol">EJB project</span> combination box, type |
| a new project name or select an EJB project from the drop-down list. Or, click |
| the <span class="uicontrol">New</span> button to launch the New EJB Project wizard.</span> If a new EJB project is created, it is created with the same version |
| as the EJB JAR being imported. If you select an EJB 2.x project and import |
| an EJB 1.1 EJB JAR file, the version of the CMP beans is set to 1.x.</li> |
| <li class="skipspace"><span>If you are importing to an existing project, select <span class="uicontrol">Overwrite |
| existing resources without warning</span>.</span></li> |
| <li class="skipspace"><span>In the <span class="uicontrol">Target server</span> 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.</span></li> |
| <li class="skipspace"><span>Specify whether you want to add the new module to an enterprise |
| application (EAR) project.</span></li> |
| <li class="skipspace"><span>In the <span class="uicontrol">EAR project</span> combination box, type |
| a new project name or select an existing enterprise application project from |
| the drop-down list. Or, click the <span class="uicontrol">New</span> button to launch |
| the New Enterprise Application Project wizard.</span> <div class="note"><span class="notetitle">Note: </span>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.</div> |
| </li> |
| <li class="skipspace"><strong>Optional: </strong><span>For EJB 2.x projects, you can select <span class="uicontrol">Add |
| support for annotated Java classes</span>.</span> Select this option |
| if you are familiar with annotations and want to use annotations to update |
| beans rather than using the deployment descriptor.<p>For more information, |
| see <a href="ceannotations.html">Support for annotated bean |
| classes</a>.</p> |
| </li> |
| <li class="skipspace"><span>Click <span class="uicontrol">Finish</span> to import the EJB JAR file.</span></li> |
| </ol> |
| <div class="skipspace"><div class="note"><span class="notetitle">Note: </span>The .ser files in an EJB 1.0 JAR are converted into the ejb-jar.xml |
| file for EJB 1.1 during an import.</div> |
| <p><span class="uicontrol">Imported .class files</span></p> |
| <p>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.</p> |
| <p>A |
| folder called <span class="uicontrol">xxx.imported_classes</span> 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.</p> |
| <p> On an |
| EJB JAR export, the contents of the <span class="uicontrol">xxx.imported_classes</span> 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 <span class="uicontrol">xxx.imported_classes</span> folder.</p> |
| </div> |
| </div> |
| |
| <div> |
| <p><b class="reltaskshd">Related tasks</b><br /> |
| <a href="../topics/tecrtpro.html" title="An EJB project is used to organize the resources contained in an EJB module.">Creating an EJB project</a><br /> |
| <a href="../topics/teexp.html" title="After you have tested your enterprise beans, you can export the module into an EJB JAR file.">Exporting EJB projects to EJB JAR files</a><br /> |
| <a href="../topics/teimpclass.html" title="You can use the Import wizard to add Java class files to an EJB project.">Importing class files to an EJB project</a><br /> |
| </p> |
| </div> <br /> |
| (C) Copyright IBM Corporation 2000, 2005. All Rights Reserved. |
| </body> |
| </html> |