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).
- Download the latest eclipse IDE from http://www.eclipse.org.
- Extract the eclipse IDE to your preferred install
location.
- Start up the eclipse IDE. When asked to select a Workspace,
browse to the <INSTALL
DIR>\Help\stkX\Samples\Java directory, and click OK.
-
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.
- Close the eclipse IDE's Welcome screen.
- From the File menu, select Import....
- In the Import dialog, open the General folder, select Existing
Projects into Workspace, and click Next.
-
- 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.
-
- Make certain that the AGI item is selected in the Projects
area, and click Finish.
-
- Navigate to the Java Build Path area on the project's
Properties page.
-
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.
- In the Source tab, check that the Default output folder (at the
bottom of the tab) is AGI/classes.
-
- 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.
-
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.
- 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.
-
- 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:
-
- Select the jar file in the Libraries tab and expand its
tree.
- If "Javadoc location" is set to "(None)", then click the
Edit.... button and:
-
- Select the "Javadoc in archive" option, and click Browse.
- 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.
- Click OK to dismiss the "Javadoc For ..." dialog and return to
the Libraries tab.
- Repeat the preceding steps once for each remaining jar file
whose Javadoc location you wish to verify or set.
- The following 5 jar files require the use of JNI libraries to
provide the STK Java API runtime capabilities:
-
- agi.core.jar
- agi.stkutil.jar
- agi.stkx.jar
- agi.stkobjects.jar
- agi.stk.jar
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:
- Select the jar file in the Libraries tab and expand its
tree.
- 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.
- Repeat the preceding steps once for each of the other 4 listed
jar files whose native library path you wish to verify or set.
- 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.
- 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.
- If the samples have not yet been compiled, then right-click on
the AGI project in the Package Explorer and select Build
Project.
- 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: