Home

 

Exporting Java applications to a JAR file

This section describes how to export a Java application to a JAR file that can be run outside Application Developer using a JRE in a Windows Command Prompt. We demonstrate how to export and run the ITSO Bank application.

To export the ITSO Bank application code to a JAR file, do these steps:

Right-click the RAD75Java project and select Export.

In the Export dialog, select Java Æ JAR file and click Next.

In the JAR Export dialog, enter the following data (Figure | -35).

Figure 8-35 JAR Export

Select the RAD75Java project.
Select Export generated class files and resources (default).
Select Export Java source files and resources.

Note: We select to export the source to demonstrate later how to import a JAR file into a project. It is not necessary or desirable to include Java sources in a JAR file for execution.

JAR file: C:\ITSOBankApplication.jar
Select Compress the contents of the JAR file (default).
Clear other check boxes.

In the JAR Packaging Options dialog accept the defaults and click Next.

In the JAR Manifest Specification dialog, click Browse for the Main class, and select the BankClient class.

Click Finish to export the entire Java project as a JAR file.

Click OK if the warning window appears.
ibm.com/redbooks