Utility object


Purpose
This sample describes how to write a utility object in Java that can be used in an ArcGIS Engine application. This sample shows how to compute the total area of the features in a particular layer.

How to use

See How to use ArcGIS samples for help on running the sample. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

Consume the extension in an ArcGIS Engine application
  1. Navigate to this sample's lib folder (utilityobject\lib) and copy the UtilityObjectExt.jar file into the ArcGIS Install Dir\java\lib\ext folder to deploy. The sample functionality is available when you start the Engine application.
  2. To run this command-line application, use Ant, execute its Java Archive (JAR) file—which is the UtilityObject.jar file under the sample's bin folder (utilityobject\bin)—from the command line, or use your integrated development environment (IDE) to compile and run it. No arguments are required to run this application.
  3. Review the calculated area in the console.


Download the files for Java
scenario/AreaCalculatorMain.java Main Java class that creates an instance of the utility object in an Engine context and calls a method on it.
scenario/extension/ICalculateArea.java Custom interface that defines the method for calculating the area, which returns a double.
scenario/extension/AreaCalculator.java Implements the custom IAreaCalculator interface and the calculateArea method.




Development licensing Deployment licensing
Engine Developer Kit Engine Runtime