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.

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.

If you installed the samples feature, you will find the files associated with this sample in <Your Developer Kit install location>\DeveloperKit10.4\Java\Samples\ArcObjects.

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