Jar and DLL Files | List of Samples

STK Java API - Included Files and Samples

The STK Java API provides a pure Java / JNI access to the STK X and STK Object Model API for STK. Its purpose is to provide means to leverage the STK X and STK Object Model capabilities in a Java application. It is to be used only with the STK version that it specifies.

This STK Java API release is based on the Java / JNI C++ source implementation provided in 4DX for UNIX versions 6.1.3 and 7.0.1. However, the use of JACOB has been replaced with AGI's own implementation of the Safe Array and Variant type objects. At this time it is planned to roll these two type changes into a future 4DX for UNIX release, thus providing a completely platform-independent Java implementation for customers with such a requirement in their 4DX/STK Java applications. Please refer to the Javadoc API for changes between Java implementations until the merge of Unix/Linux/Windows occurs (currently scheduled for 4DX for UNIX 8.0.2).

The STK Java API jar files require minimally Sun Microsystem's Java Development Kit installation of 1.4.2_10 on Windows and 1.4.1_08_b03 on UNIX / Linux. Issues with Sun Microsystem's JDK 1.4.2_11, 1.4.2_12, and 1.5.0_06 have been found and are not supported by AGI due to SUN Bug Id 6385867, 6405062. MDI type applications using AgUiAxVOCntrl and AvUiAx2DCntrl with a JInternalFrame and JDesktopPane are not supported due to SUN Bug Id of 4154448. Please refer to Sun's documentation on mixing HeavyWeight/LightWeight components at http://java.sun.com/products/jfc/tsc/articles/mixing/. Currently, the STK Java API has been tested against Sun Microsystem's JDK versions as described in the following table, however, other JDK's versions may also work except those listed previously as not supported.

Tested Sun Microsystems JDK Versions & Platforms
Sun JDK Version OS Platform
1.4.2_08_b03 Linux / Solaris
1.4.2_10 Windows
1.5.0_04 Linux / Solaris
1.5.0_09 Windows
1.5.0_11 Windows
1.6.0 Linux / Solaris

Note: It is strongly recommended that you use eclipse 3.2.x or greater as an IDE for development of Java applications using the STK Java API.

Jar and DLL Files included with the STK Java API

Jar files included with the STK Java API are listed in the following table:

Jar Files in STK Java API
Name Description Required in
Classpath?
agi.javadocs.jar Contains the HTML javadocs for this Java implementation API. The file can be unzipped to your preferred Javadoc location. no
agi.util.jar Helpful Java API tools created by AGI that are not used by the Java implementation API. They are pure Java tools. yes
agi.logging.jar AGI's java.util.logger Formatter for Console Logging, utilized by the Java implementation API when logging is enabled as shown in the sample java applications provided in this release. yes
agi.jar AGI's lowest level jar file, which contains types utilized by all STK Java API code. yes
agi.core.jar AGI low level jar file that contains implementations of classes that allow for proxy calls to be made between Java / JNI / C++ / Microsoft / STK yes
agi.stkutil.jar STK Java API implementation of the native AgStkUtil.dll yes
agi.stkx.jar STK Java API implementation of the native STKX.dll yes
agi.stkobjects.jar STK Java API implementation of the native AgStkObjects.dll yes
agi.stk.jar STK Java API implementation of the STK Application for creation or attachment to a running instance, to allow automation of the application at runtime yes

Some jar files (see the 3rd column of the above table) must be set within the Java CLASSPATH environment variable before compilation or running of any samples or java applications.

Note: If you are running these examples with Eclipse, then there is no need to set these environment variables; Eclipse will handle them automatically.

The following is an example of setting the CLASSPATH environment varible:

set CLASSPATH=.
set CLASSPATH=%CLASSPATH%;<INSTALL DIR>\bin\agi.jar
set CLASSPATH=%CLASSPATH%;<INSTALL DIR>\bin\agi.logging.jar
set CLASSPATH=%CLASSPATH%;<INSTALL DIR>\bin\agi.util.jar
set CLASSPATH=%CLASSPATH%;<INSTALL DIR>\bin\agi.core.jar
set CLASSPATH=%CLASSPATH%;<INSTALL DIR>\bin\agi.stkutil.jar
set CLASSPATH=%CLASSPATH%;<INSTALL DIR>\bin\agi.stkx.jar
set CLASSPATH=%CLASSPATH%;<INSTALL DIR>\bin\agi.stkobjects.jar
set CLASSPATH=%CLASSPATH%;<INSTALL DIR>\bin\agi.stk.jar

where <INSTALL DIR> is where you unzipped the Java Implementation API.

The following table lists native JNI DLL files that are required by the jar file implementations:

Native JNI DLL Files
Name Description Required
In PATH?
AgJNICore.dll Provides an STK Java API implementation of low level proxy calls between Java / JNI / C++ / Microsoft / STK yes
AgJNIStkUtil.dll Provides an STK Java API implementation of JNI calls to AgStkUtil.dll. Required by agi.stkutil.jar. yes
AgJNIStkX.dll Provides an STK Java API implementation of JNI calls to STKX.dll. Required by agi.stkx.jar. yes
AgJNIStkObjects.dll Provides an STK Java API implementation of JNI calls to AgStkObjects.dll. Required by agi.stkobjects.jar. yes
AgJNIStk.dll Provides an STK Java API implementation of JNI calls to an STK Application. Required by agi.stk.jar yes

Unless you are using eclipse, you must set the PATH environment variable to point to the parent folder where these native DLLs reside, e.g.:

set PATH=<INSTALL DIR>\bin; %PATH%

STK Java API Samples

Samples shipped with this STK Java API release are listed in the table below. These include sample Java applications and features of STK X and the STK Object Model that can add value to your Java application.

Instructions on configuring the samples are provided.

Tip: The names of the samples appear without package space information in the following table. Within the package space (agi.samples), each sample appears in a directory based on its name. Thus, the unabridged directory version of AllowScrollbars is agi/samples/allowscrollbars/AllowScrollbars.java.

STK Java API Samples
Sample Description
AllowScrollbars Provides detailed example code of how to turn on the 2D Map scrollbar capability during Zoom In and Zoom Out of specific global regions.
AnimateModes Provides detailed example code of how to adjust the animation drawing to real time, multiple of real time, or custom animation.
DrawRects Provides detailed example code of how to draw rectangular boxes on the 3D Globe control and how to react to the drawing in order to implement specific application domain knowledge.
Events Provides detailed example code of how to react to event notification within STK X and STK Object Model events like new Object creation, Animation Time update, etc.
GfxAnalysis Provides detailed example code of how to use the AgUiAxGfxAnalysisCntrl, which provides graphics analysis for Solar Panel Tool, Area Tool, etc.
ObjModel Provides detailed example code of how to utilize the STK Object Model API.
OleDragDrop

Provides detailed example code of how to respond to OLE Drag and Drop of system files event notification. In this sample, .connect files can be dragged from the folder where this sample resides onto the 3D Globe control. Within these files are connect commands that the Java application will read and pass on to the AgStkObjectRoot.executeCommand() method.

OMTutBeg Provides the beginning source and commented instructions as a tutorial to help one learn how to develop a Java application using the STK Object Model. This sample will not compile out of the box.
OMTutEnd Provides the end source for a solution to the OMTutBeg sample. This sample compiles out of the box.
OnAnimUpdate Provides detailed example code of how to respond to an Animation Update event notification.
RubberBandSelect Provides detailed example code of how to select a region within the 3D Globe control and receive information related to which objects (Aircraft, GroundVehicles, Satellites, AreaTargets, etc.) currently reside in that region.
SimpleMap Provides detailed example code of how to include an AgUiAx2DCntrl (a.k.a 2D or Map) into a Java application. This sample exists to show the simplicity of code required to add the Map to a Java application.
SimpleVo Provides detailed example code of how to include a AgUiAxVOCntrl (a.k.a 3D or Globe or VO) into a Java application. This sample exists to show the simplicity of code required to add the Globe to a Java application.
Sisp Provides detailed example code of a SISP (Single Integrated Space Picture) Java application, to show that very complex applications can be written with the Java implementation API.
StkAutomation Provides a sample that shows how to create a Java application as a process that can connect and automate to an external STK Application process.
StkxTutorial Provides detailed example code of how to create Map/Globe controls and add event listeners for event notification. This java application is similar to the version implemented with J-Integra provided with an STK installation.
TabPanes Provides detailed example code of how to create a Java application that provides Globe and Map controls within a Java JTabbedPane container. In addition this sample shows how one can create "closeable" tabpanes with Globe and Map controls.
agi.samples.swing.* This package and its sub packages show implementation of common Swing GUI components that could be shared across many applications. For example we provide an implementation of an Animate_JToolBar, Connect_JToolBar, JTabbedPanes that contain Globe and Map controls, etc.