STK Java API - Verifying Setup of Java Code Samples
For the Desktop and Compute mode with Graphics use cases:
- Open a new shell window. Make sure that you have set up the environment variables in the shell window, as described in Setting Up the Environment.
- Go to the samples directory by entering:
- Make sure $JAVA_HOME is configured correctly. It should point to the 64-bit JDK. This can be verified as follows:
- Once you have verified that JAVA_HOME points to the expected JDK, run the example by entering:
cd <STK Install folder>/CodeSamples/CustomApplications/Java/AWT_STK_X_Globe_View
$JAVA_HOME/bin/java -d64 -version It should print out the version number and no error.
ant run
The example compiles and then runs. An application opens. In the scenario menu use the New Scenario option to create a new scenario. The application displays a new 3D view as shown below.
Alternatively, for the Compute mode with no graphics use case:
- Open a new shell window. Make sure that you have set up the environment variables in the shell window, as described in Setting Up the Environment.
- Go to the samples directory by entering:
- Make sure $JAVA_HOME is configured correctly; it should point to a 64-bit JDK. This can be verified as follows:
- Once you have verified that JAVA_HOME points to the expected JDK, run the example by entering:
cd <STK Install folder>/CodeSamples/CustomApplications/Java/AWT_STK_X_NoGraphics
$JAVA_HOME/bin/java -d64 -Djava.awt.headless=true -version If this is a 64-bit jvm it should print out the version number and no error. If it is not a 64-bit jvm it will return an error (the error message will be similar to: “Running a 64-bit JVM is not supported on this platform.”).
ant run
The example will be compiled and then run. The application will compute access between a facility and a satellite, and will output the results to the console.
This demonstrates that your Java environment is fully setup and ready for development. For the next step in Java development, you can explore the documentation and the other examples. See Configuring Eclipse Projects and Configuring the Samples with the Eclipse IDE.