STK Java API - Compile and Run Samples with Ant

The following instructions explain how to compile and run the STK Java API code samples provided in the STK install with Apache Ant. The instructions assume you have already installed Ant and configured it to run on the command line.

  1. First, you will have to either set an environment variable, STK_INSTALL_DIR, to the installation directory or set stk.install.dir ant variable in step 3. (Ex: ant -Dstk.install.dir="C:\Program Files (x86)\AGI\STK 11" run)

  2. In a command window, cd into the code sample folder you wish to compile. For example:
  3. <STK_INSTALL_DIR>/CodeSamples/CustomApplications/Java/AWT_STK_X_Globe_Basic

  4. All Java samples have a build.xml file that will compile the sample, its dependencies and then run the sample. Run the following command from the directory:
  5. ant run


    ant -Dstk.install.dir="C:\Program Files (x86)\AGI\STK 11" run

    Note: Besides the run target, the Ant scripts also contain a compile and a clean target. There is also a top level ant script that will compile all samples inside the current directory. These are located in the folders named Java (Ex: <STK_INSTALL_DIR>/CodeSamples/CustomApplications/Java). This script only has a compile and a clean target.

STK 11.2.1 Programming Interface