7 Mart 2012 Çarşamba

Eclipse - How to build Jar File

link

Creating a New JAR File
To create a new JAR file in the workbench:

1. In the Package Explorer, you can optionally pre-select one or more Java elements to export. (These will be automatically selected in the JAR Package Specification wizard page, described in Step 4.)
2. Either from the context menu or from the menu bar's File menu, select Export.
3. Expand the Java node and select JAR file. Click Next.
4. In the JAR File Specification page, select the resources that you want to export in the Select the resources to export field.
5. Select the appropriate checkbox to specify whether you want to Export generated class files and resources or Export Java source files and resources. Note: Selected resources are exported in both cases.
6. In the Select the export destination field, either type or click Browse to select a location for the JAR file.
7. Select or clear the Compress the contents of the JAR file checkbox.
8. Select or clear the Overwrite existing files without warning checkbox. If you clear this checkbox, then you will be prompted to confirm the replacement of each file that will be overwritten.
9. Note: The overwrite option is applied when writing the JAR file, the JAR description, and the manifest file.
10. You have two options:
Click Finish to create the JAR file immediately.
Click Next to use the JAR Packaging Options page to set advanced options, create a JAR description, or change the default manifest.

Creating a new manifest
1. Follow the procedure for creating a JAR file, but click Next in the last step to go to the JAR Packaging Options page.
2. Set any advanced options that you want to set, and then click Next again to go to the JAR Manifest Specification page.
3. If it is not already selected, click the Generate the manifest file button.
4. You can now choose to save the manifest in the workbench. This will save the manifest for later use. Click Save the manifest in the workspace, then click Browse next to the Manifest file field to specify a path and file name for the manifest.
5. If you decided to save the manifest file in the previous step and you chose to save the JAR description on the previous wizard page, then you can choose to reuse it in the JAR description (by selecting the Reuse and save the manifest in the workspace checkbox). This means that the saved file will be used when the JAR file is recreated from the JAR description.This option is useful if you want to modify or replace the manifest file before recreating the JAR file from the description.
6. You can choose to seal the JAR and optionally exclude some packages from being sealed or specify a list with sealed packages. By default, nothing is sealed.
7. Click the Browse button next to the Main class field to specify the entry point for your applications.
8. Note: If your class is not in the list, then you forgot to select it at the beginning.
Click Finish. This will create the JAR, and optionally a JAR description and a manifest file.

Hiç yorum yok:

Yorum Gönder