18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

JAVA APPLICATION PROGRAMMING INTERFACE<br />

184 • <strong>ArcGIS</strong> <strong>Engine</strong> <strong>Developer</strong> <strong>Guide</strong><br />

scripts written in XML. You can either load these samples into your preferred<br />

development environment or use the ANT scripts to compile and run them.<br />

If you want to use ANT scripts, you should have a working ANT installation.<br />

For the <strong>ArcGIS</strong> <strong>Engine</strong> samples, any ANT version 1.5.3 or higher will work. For<br />

your convenience, a version of ant, called arcgisant, is included under the<br />

<strong>ArcGIS</strong>\<strong>Developer</strong>Kit\tools directory on Windows and the arcgis/developerkit/<br />

tools directory on Solaris and Linux.<br />

The ANT scripts included with the samples require certain additional environment<br />

settings:<br />

• ANT_HOME should point to your ANT installation directory. For example:<br />

ANT_HOME=C:\<strong>ArcGIS</strong>\<strong>Developer</strong>Kit\tools\ant<br />

Solaris and Linux developers can source arcgis/developerkit/tools/<br />

setenv_ant.csh or setenv_ant.sh, which sets this variable and includes arcgisant’s<br />

bin directory in the PATH.<br />

JRE<br />

The <strong>ArcGIS</strong> <strong>Engine</strong> and Server developer kits include a version of the Java<br />

Runtime Environment (JRE). This enables you to run any <strong>ArcGIS</strong> Java application<br />

as long as all the necessary settings described above are local to the runtime.<br />

You will notice the necessary *.dll files in the bin directory and the necessary *.jar<br />

files in the library extension directory. All you need to do to get started with this<br />

runtime environment is ensure that the bin directory is added to your PATH<br />

environment variable:<br />

PATH=...;\<strong>ArcGIS</strong>\java\jre\bin<br />

JAVA PROGRAMMING TECHNIQUES<br />

This section provides you with some fundamental concepts of the Java programming<br />

language. It assumes you understand general programming concepts but are<br />

relatively new to Java.<br />

Features of the Java Virtual Machine<br />

The JVM specification provides a platform-independent, abstract computer for<br />

executing code. The JVM knows nothing about the Java language; instead, it<br />

understands a particular binary format, the class file that contains instructions in<br />

the form of bytecodes. The Java Virtual Machine specification provides an environment<br />

that both compiles and interprets programs. The compiler takes a .java<br />

file, produces a series of bytecodes, and stores them in a .class file, and the Java<br />

interpreter executes the bytecodes stored in the .class file.<br />

Each implementation of the JVM interacts with the operating system. The JVM<br />

handles such things as memory allocation, garbage collection, and security monitoring.<br />

Java Native Interfaces<br />

Even though Java programs are designed to run on multiple platforms, there may<br />

be times where the standard Java class library doesn’t support platform-dependent<br />

features needed by a particular application or a Java program needs to implement<br />

a lower-level program and have the Java program call it. The JNI is a standard<br />

cross-platform programming interface provided by the Java language. It

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

Saved successfully!

Ooh no, something went wrong!