How to export extension classes as a JAR file


Summary
The deployment mechanism for extending ArcGIS Desktop or Server requires that you bundle the extension Java classes as a Java Archive (JAR) file. The JAR file is placed in the <ArcGIS Desktop Home>\java\lib\ext or <ArcGIS Server Home>/user/lib/ext folders to be recognized by ArcGIS. You can create a JAR file using either the Eclipse integrated development environment (IDE) or at the command line. This topic shows you how to use both.
The deployment workflow described in the topic does not apply to Server Object Extensions. For more information about deploying Server Object Extensions, please see the "Developing Extensions" -> "Server Object Extensions" topics.

In this topic


Export using the Eclipse IDE

To export extension classes using the Eclipse IDE, follow these steps:

Create a manifest file (optional)

If your extension classes include reference to external libraries and external JAR files, the external dependencies must be specified in a manifest file and included in the JAR file with the corresponding Java classes. If your extension classes do not include external references, you do not need to create a manifest file.

To create a manifest file in the Eclipse IDE, follow these steps:
  1. Right-click the project, click New, and click Other as shown in the following illustration:



    The New wizard dialog box opens. 
  2. Select File under the General node and click Next as shown in the following screen shot:



    The New File dialog box opens.
  3. Select the project, enter a file name, and click Finish as shown in the following screen shot:



    A file is created in the specified project.
  4. List the dependent libraries and JAR files in the file under the Class-path header as follows:
Manifest-Version: 1.0
Class-Path: MyUtils.jar demo/gismath.jar
  1. Save the file and close it.
The manifest text file must end with a new line or carriage return to parse properly.

Create a JAR file

To create a JAR file, follow these steps:
  1. Select the Java extension classes, right-click and select Export from the context menu as shown in the following screen shot:



    The Export dialog box opens.
  2. Select the JAR file and click Next as shown in the following screen shot:



    The JAR Export File Specification dialog box opens. 
  3. Select the project.
  4. Check the Export generated class files and resources check box.
  5. Browse to the export destination.
  6. Click Next.
    These steps are shown in the following screen shot:



    The JAR Export Packaging Options dialog box opens.
  7. If you did not create the optional manifest file, click Finish, and go to step 10.
  8. If you created a manifest file, click Next as shown in the following screen shot:



    The JAR Export Manifest Specification dialog box opens.
  9. Click the Use existing manifest from workspace radio button, browse to and select the manifest file in your project, and click Finish as shown in the following screen shot: 

  10. Go to the export destination file to verify that you successfully created a JAR file.

Export using the command line

To export a custom geoprocessing tool using the command line, follow these steps:
  1. Create a text file called manifest.txt with the following contents:
Manifest-Version: 1.0
Class-Path: MyUtils.jar demo/gismath.jar
  1. Type the following command at the command line to create a JAR file for the associated classes:
jar -cfm <jar-file-name> <manifest file name> <packagename>/*.class
  1. Go to the export destination file to verify that you successfully created a JAR file. Copy the JAR file to <ArcGIS Install Dir>\java\lib\ext folder.






Development licensingDeployment licensing
Engine Developer KitEngine
ServerServer