The Stateless EJB needs to be packaged in a JAR file. Right click the Calculator project in the Package Explorer View and select the Properties context menu.
Select the Packaging Configurations option:
At the top of the page there is a check-box labeld Enable Packaging. Check this check-box.
Click the Add... button. Type calculator.jar in the dialog and click the OK button.
You have created a new packaging configuration that will produce the calculator.jar file.
We want to add the Stateless EJB class and interface. Eclipse has generated the compiled classes into the bin folder (declared as the default output dir of the project).
Select the calculator.jar item and right-click in the area to pop-up the menu and choose Add Folder. A Folder Selection dialog appears.
This dialog allows to select which folder (local to workspace or in the file system) to include into the package, to specify include and exclude filters and to set a prefix that will be append when building the package.
Click on the Project Folder... button. A Folder Chooser dialog appears.
This dialog allows selecting which folder to include. This folder can be choosen among all the opened projects.
Select the /Calculator/bin folder and click the OK button.
The folder is now /Calculator/bin.
As we only want the EJB class and interface, specify the following as an include filter:
Click the OK button.
The packaging configuration for the calculator.jar is now complete.
Click the OK button to save the packaging configuration.
Right-click on the Calculator project and select Run Packaging. The packaging will display its output in the console. The output should look like this:
Buildfile: C:\ejb3workspace\Calculator\packaging-build.xml N65540: [jar] Building jar: C:\ejb3workspace\Calculator\calculator.jar _packaging_generation_: BUILD SUCCESSFUL Total time: 875 milliseconds
After the execution, you should have a project that looks like this: