STK Java API - Configuring the Samples with the Eclipse IDE

The following instructions explain how to configure the STK Java API samples within the eclipse Integrated Development Environment (IDE).

  1. Download the latest eclipse IDE from http://www.eclipse.org.
  2. Extract the eclipse IDE to your preferred install location.
  3. Start up the eclipse IDE. When asked to select a Workspace, browse to the <INSTALL DIR>\Help\stkX\Samples\Java directory, and click OK.
  4. Note:If the eclipse IDE launches without displaying the above dialog, open the File menu and select Switch Workspace to display it, then browse to the above directory.

  5. Close the eclipse IDE's Welcome screen.
  6. From the File menu, select Import....
  7. In the Import dialog, open the General folder, select Existing Projects into Workspace, and click Next.
  8. Choose "Select root directory" and click the Browse button. Do not change the directory; instead, just click OK to dismiss the Browse for Folder dialog.
  9. Make certain that the AGI item is selected in the Projects area, and click Finish.
  10. Navigate to the Java Build Path area on the project's Properties page.
  11. Note: If you were not presented with the Properties page, display it by right-clicking on the AGI project in the Package Explorer and selecting Properties from the context menu.

  12. In the Source tab, check that the Default output folder (at the bottom of the tab) is AGI/classes.
  13. Click the Libraries tab, and note the jar files listed there and the directory path given for them. Go to the indicated directory (e.g. with Windows Explorer) to verify that all the listed files are, in fact, in the indicated directory. If they are, you can skip the next step.
  14. Note: In the illustration, the 8 jar files are in the bin folder in the default STK install directory. This is the default location for the jar files.

    Tip: Some of the following steps may require editing of the project's Properties. Before performing such editing, you may want to make sure that the file is writable. See the section on Saving Project Settings at the end of this page.

  15. If the jar files are not in the indicated directory, then select all the jar files in the Libraries tab and click the Remove button. Click the Add External JARs... button, navigate to the bin folder in the default STK install directory, select all the jar files except agi.javadocs.jar, and click Open.
  16. The Javadoc location for each jar file in the project should have been set automatically to agi.javadocs.jar when you imported the project. To verify that the location has been set or, if it has not been set, to set the location:
    1. Select the jar file in the Libraries tab and expand its tree.
    2. If "Javadoc location" is set to "(None)", then click the Edit.... button and:
      1. Select the "Javadoc in archive" option, and click Browse.
      2. In the Java Archive Selection dialog, navigate to the folder that contains this project's jar files (probably the bin folder of the default STK install directory), select agi.javadocs.jar, and click Open.
      3. Click OK to dismiss the "Javadoc For ..." dialog and return to the Libraries tab.
    3. Repeat the preceding steps once for each remaining jar file whose Javadoc location you wish to verify or set.

  17. The following 5 jar files require the use of JNI libraries to provide the STK Java API runtime capabilities:

  18. To verify that the native library path for each of these jar files has been set (or, if necessary, to set the path), proceed as follows:
    1. Select the jar file in the Libraries tab and expand its tree.
    2. If "Native library location" is set to " (None)", then click the Edit.... button, select the External Folder... button, navigate to the bin folder of the default STK install directory, and click OK twice to return to the Libraries tab.
    3. Repeat the preceding steps once for each of the other 4 listed jar files whose native library path you wish to verify or set.

  19. If you have changed any settings on the Properties page, verify that it is writable, and click OK to save the settings and dismiss the page.
  20. Check to see if the samples have already been compiled. The eclipse IDE automatically compiles Java files when they are added or changed within a project. Open the Project menu and see whether a check mark appears next to the Build Automatically item. If so, the samples have been compiled, and you can skip the next step.
  21. If the samples have not yet been compiled, then right-click on the AGI project in the Package Explorer and select Build Project.
  22. Note that one sample will not compile, namely the agi.samples.omtutbeg.Main.java source file. The errors are due to intentional gaps that you are to fill as an exercise and compare against the agi.samples.omtutend.Main.java file. Doing so will give you practice with the SDK, the STK Object Model and the eclipse IDE.

Saving Project Settings

To make certain that you will be able to save any changes you make to the project's Properties page, find the .classpath file and verify that it is writable. The .classpath file is located at:

   <INSTALL DIR>\Help\stkX\Samples\Java\AGI\

If you do not see the .classpath file at that location, open Windows Explorer, select Folder Options from the Tools menu, click the View tab, and select the 'Show hidden files and folders' option: