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.

JAVA APPLICATION PROGRAMMING INTERFACE<br />

The <strong>ArcGIS</strong> API for the Java platform is a programming interface that<br />

interoperates with ArcObjects and is specifically designed to target Java developers.<br />

Java technology is both a platform and an object-oriented programming<br />

language developed by Sun Microsystems that comes in three versions and consists<br />

of two components:<br />

Versions:<br />

• Java 2 Platform, Standard Edition (J2SE)<br />

• Java 2 Platform, Enterprise Edition (J2EE)<br />

• Java 2 Platform, Micro Edition (J2ME)<br />

Components:<br />

• Java Virtual Machine (JVM)—Java runtime and client/server compilers.<br />

• Java application programming interface—Suite of core, integration, and user<br />

interface toolkits.<br />

The Java language is important because it is an open standard. All implementations<br />

of the programming language must meet the specifications provided for the<br />

JVM. This enables applications to run on any hardware platforms that host the<br />

JVM.<br />

PLATFORM CONFIGURATION<br />

This section will describe all the necessary configurations needed to be productive<br />

with the Java API including class path and environment settings.<br />

Setting the JAVA_HOME variable is not<br />

absolutely necessary; however, some Java IDEs<br />

and Java tools require it be set.<br />

The PATH environment variable is a list of<br />

directory paths for executables such as javac,<br />

java, and javadoc. When an executable is<br />

specified without a path, this variable is used to<br />

help locate that executable.<br />

Java developer kit<br />

To develop with ArcObjects using the <strong>ArcGIS</strong> API for Java, you must have the<br />

Java 2 Platform Standard Software developer kit (J2SDK) installed. All of your<br />

J2SDK tools are located in the install directory. You can either explicitly invoke<br />

them from that directory or add it to your PATH environment variable. Adding<br />

the directory to your PATH variable involves two steps:<br />

1. Create a new environment variable named JAVA_HOME.<br />

JAVA_HOME=[path to JDK install directory]<br />

For example:<br />

JAVA_HOME=c:\j2sdk<br />

2. Edit the PATH variable to include the bin directory of JAVA_HOME.<br />

PATH=...;%JAVA_HOME%\bin<br />

To compile server-based applications, such as servlets and EJBs, you will also<br />

need to install and include the Java 2 Enterprise Edition toolkit in your class<br />

path. Java application servers generally provide this, or you can get the reference<br />

implementation provided by Sun Microsystems.<br />

<strong>ArcGIS</strong> <strong>Engine</strong><br />

<strong>ArcGIS</strong> API for Java developer kit uses standard Java Native Interface (JNI) to<br />

access core ArcObjects components. This requires some native libraries to be in<br />

your path when compiling and running applications. You must be sure to include<br />

the correct paths to invoke interoperability into native ArcObjects. The native<br />

*.dll or *.so files are located in the bin subdirectory under <strong>ArcGIS</strong>.<br />

182 • <strong>ArcGIS</strong> <strong>Engine</strong> <strong>Developer</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!