18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

BUILDING A COMMAND-LINE JAVA APPLICATION<br />

• ANT_HOME=%ARCENGINEHOME\<strong>Developer</strong>Kit\tools\ant<br />

Setting up environment variables on Solaris and Linux<br />

To configure your environment on Solaris and Linux you should source two setup<br />

scripts. The init_engine script in the <strong>ArcGIS</strong> installation directory sets the<br />

ARCENGINEHOME environment variable as well as several required paths.<br />

The setenv_ant script in arcgis/developerkit/tools sets the ANT_HOME variable<br />

to point to arcgisant and includes arcgisant’s bin directory in your PATH.<br />

• If you use C-shell:<br />

To compile and run applications using the <strong>ArcGIS</strong><br />

<strong>Engine</strong> <strong>Developer</strong> Kit, the PATH environment<br />

variable should include paths to <strong>ArcGIS</strong>/bin and<br />

J2SE JRE/bin. In addition, <strong>ArcGIS</strong> <strong>Engine</strong> <strong>Developer</strong><br />

Kit ships with an extended version of Ant<br />

called arcgisant. The path to this tool should<br />

also be included.<br />

Folder and file structure required for the build<br />

scripts to work as desired<br />

source .../arcgis/init_engine.csh<br />

source .../arcgis/developerkit/tools/setenv_ant.csh<br />

• If you use bash or bourne shell:<br />

source .../arcgis/init_engine.sh<br />

source .../arcgis/developerkit/tools/setenv_ant.sh<br />

You should also set the JAVA_HOME environment variable to point to the<br />

install location of your J2SE SDK.<br />

• Using C-shell:<br />

setenv JAVA_HOME [J2SE SDK install directory]<br />

• Using bash or bourne shell:<br />

JAVA_HOME=[J2SE SDK install directory]<br />

Build scripts<br />

Before proceeding with building the application itself, you need to prepare the<br />

build scripts. It is vital to set up the build structure as illustrated to the left for<br />

the scripts to work correctly.<br />

• TintoPoint folder—root folder for the project<br />

• src folder—subfolder containing all of the application’s source code<br />

• build.xml—Ant build script file<br />

• properties.xml—external Ant properties file, which extends the build environment<br />

• sample.properties—external Java properties file with command-line parameters<br />

The three files—build.xml, properties.xml, and sample.properties—must be<br />

created before you can build and run the scenario.<br />

Creating the sample.properties file<br />

Begin by creating the sample.properties file. This file provides the build script<br />

with necessary command-line arguments to successfully execute the application<br />

created in this exercise. This file will use the variable=argument pattern.<br />

1. Create a text file named sample.properties and add the following lines of code<br />

to it. Revise the arguments for the variables input.tin.path and<br />

output.shape.path to match the paths to your TIN dataset and output<br />

shapefile dataset.<br />

# TinToPoint<br />

unit.name=TintoPoint<br />

Chapter 6 • <strong>Developer</strong> scenarios • 411

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!