Home

 

Importing Java resources from a JAR file into a project

This section describes how to import Java resources from a JAR file into an existing Java project in the workspace.

We use the ITSOBankApplication.jar file which we have created in Exporting Java applications to a JAR file. Alternatively, you can use the ITSOBankApplication.jar provided in the c:\7672code\java\jar directory included with the Redbooks publication sample code.

Create a Java project called RAD75JavaImport with the default options.

Right-click the RAD75JavaImport project in the Package Explorer and select Import.

In the Import dialog, select General Æ Archive File and click Next.

In the Import - Archive File dialog, click Browse and locate the JAR file (for example, c:\ITSOBankApplication.jar).

Clear the files .classpath and .project and the folder META-INF. These files are created when required.

Select RAD75JavaImport/src as Into folder, and click Finish.

Test the imported Java project, select and run the BankClient class from the Package Explorer.
ibm.com/redbooks