agi.core.AgCoreException: jawt module load failed
at agi.core.AgCanvas.getNativeCanvas(Unknown Source)
at agi.core.AgContainer.paint(Unknown Source)
...you can resolve this issue by implementing the following directions:
java.lang.NoClassDefFoundError: agi/stkobjects/astrogator/AgStkobjectsAstrogator_JNI
at agi.core.awt.AgAwt_JNI.initializeJNI_All(Unknown Source)
at agi.core.awt.AgAwt_JNI.initialize(Unknown Source)
at agi.samples.customapplications.allowscrollbars.Main.main(Main.java:74)
Caused by: java.lang.ClassNotFoundException: agi.stkobjects.astrogator.AgStkobjectsAstrogator_JNI
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 3 more
...you can resolve this issue by adding the specific STK Java
API jar file to the application's configuration settings. The
exception above was experienced because the
agi.stkobjects.astrogator.jar
library was not added to
the application's configuration settings.
java.lang.UnsatisfiedLinkError: no agjnicore in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at agi.core.AgCore_JNI.load(Unknown Source)
at agi.core.AgCore_JNI.(Unknown Source)
at agi.core.awt.AgAwt_JNI.initializeJNI_All(Unknown Source)
at agi.core.awt.AgAwt_JNI.initialize(Unknown Source)
at agi.samples.customapplications.allowscrollbars.Main.main(Main.java:74)
agi.core.awt.AgAwtException: agi.core.awt.AgAwtException: agi.core.AgCoreException: java.lang.reflect.InvocationTargetException
at agi.core.awt.AgAwt_JNI.initialize(Unknown Source)
at agi.samples.customapplications.allowscrollbars.Main.main(Main.java:74)
Caused by: agi.core.awt.AgAwtException: agi.core.AgCoreException: java.lang.reflect.InvocationTargetException
at agi.core.awt.AgAwt_JNI.initializeJNI_All(Unknown Source)
... 2 more
Caused by: agi.core.AgCoreException: java.lang.reflect.InvocationTargetException
at agi.core.AgCore_JNI.initialize(Unknown Source)
... 3 more
Caused by: agi.core.awt.AgAwtException: java.lang.reflect.InvocationTargetException
at agi.core.awt.AgAwtToolkitThreadDelegate.invokeAndWait(Unknown Source)
at agi.AgWindowToolkitThreadDelegate.invokeAndWait(Unknown Source)
... 4 more
Caused by: java.lang.reflect.InvocationTargetException
at java.awt.EventQueue.invokeAndWait(Unknown Source)
at javax.swing.SwingUtilities.invokeAndWait(Unknown Source)
... 6 more
Caused by: java.lang.UnsatisfiedLinkError: agi.core.AgCore_JNI.Initialize()V
at agi.core.AgCore_JNI.Initialize(Native Method)
at agi.core.AgCore_JNI.initializeInternal(Unknown Source)
at agi.core.AgCore_JNI.access$200(Unknown Source)
at agi.core.AgCore_JNI$InitializeRunnable.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
...you can resolve this issue by adding the specific STK Java API JNI library parent directory to the application's configuration settings.
agi.core.AgCoreException
at agi.core.AgUnknown.createInstance(Unknown Source)
at agi.core.AgUnknown.initialize(Unknown Source)
at agi.core.AgUnknown.(Unknown Source)
at agi.stkx.AgSTKXApplication.(Unknown Source)
at agi.samples.allowscrollbars.AllowScrollbars.initialize(AllowScrollbars.java:108)
at agi.samples.allowscrollbars.AllowScrollbars.(AllowScrollbars.java:101)
at agi.samples.allowscrollbars.AllowScrollbars.main(AllowScrollbars.java:90)
Caused by: java.lang.reflect.InvocationTargetException
at java.awt.EventQueue.invokeAndWait(EventQueue.java:997)
at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1323)
... 7 more
Caused by: agi.core.AgComException: Could not retrieve COM error description
at agi.stkx.AgSTKXApplication.CreateInstance(Native Method)
at agi.core.AgUnknown$CreateInstanceRunner.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
...you can resolve this issue by making sure STK / STK Engine is properly installed and its STKX / STKUtil / STKObjects dll's are registered properly.
import agi.stkx.*;
public class MyClass
{
private AgSTKXApplicationClass m_AgSTKXApplication;
public MyClass()
{
//... other STK Java API initialization depending on AWT/SWT/Headless context
this.m_AgSTKXApplication = new AgSTKXApplicationClass();
//... continue with additional STK Java API code
}
//... other code
}
import agi.stkx.*;
import agi.stkobjects.*;
public class MyClass
{
private AgSTKXApplicationClass m_AgSTKXApplication;
private AgStkObjectRootClass m_AgStkObjectRoot;
public MyClass()
{
// ... other STK Java API initialization depending on AWT/SWT/Headless context
this.m_AgSTKXApplication = new AgSTKXApplicationClass();
// NOTE: You must create the AgSTKXApplication (STK Engine) before creating the Object Model Root object
this.m_AgStkObjectRoot = new AgStkObjectRootClass();
//... continue with additional STK Java API code
}
}
import agi.stk.ui.*;
public class MyClass
{
private AgStkUi m_AgStkUi;
public MyClass()
{
//... other STK Java API initialization depending on AWT/SWT/Headless context
this.m_AgStkUi = new AgStkUi();
//... continue with additional STK Java API code
}
//... other code
}
import agi.stk.ui.*;
public class MyClass
{
private AgStkUi m_AgStkUi;
public MyClass()
{
//... other STK Java API initialization depending on AWT/SWT/Headless context
this.m_AgStkUi = AgStkUi.getStkUiInstance();
//... continue with additional STK Java API code
}
}
// NOTE: You must previously create/attach to an AgStkUi instance before retrieving the Object Model Root refernce
AgStkObjectRootClass root = (AgStkObjectRootClass)this.m_AgStkUi.getIAgStkObjectRoot();
this.m_AgStkObjectRoot._newScenario("test");
IAgStkObject scenObj = this.m_AgStkObjectRoot.getCurrentScenario();
IAgStkObject facObj = scenObj.getChildren()._new(AgESTKObjectType.eFacility, "facility1");
// NOTE: Instead of using a casting operator you must pass a reference
// of a base type into a constructor of a derived type in order to access a specific type's functionality. This is due to the
// fact that there is no Java operator overloading and the necessity to do a native cast on the native resources.
IAgScenario scen1 = new AgScenario(m_AgStkObjectRoot.getCurrentScenario(),b>);
// or
IAgScenario scen2 = new AgScenarioClass(m_AgStkObjectRoot.getCurrentScenario());
// or
AgScenarioClass scen3 = new AgScenarioClass(m_AgStkObjectRoot.getCurrentScenario());
// NOTE: Instead of using a casting operator you must pass a reference
// of a base type into a constructor of a derived type in order to access a specific type's functionality. This is due to the
// fact that there is no Java operator overloading and the necessity to do a native cast on the native resources.
IAgFacility fac1 = new AgFacility(scen3.getChildren()._new(AgESTKObjectType.eFacility, "Fac1"));
// or
IAgFacility fac2 = new AgFacilityClass(scen3.getChildren()._new(AgESTKObjectType.eFacility, "Fac1"));
// or
AgFacilityClass fac3 = new AgFacilityClass(scen3.getChildren()._new(AgESTKObjectType.eFacility, "Fac1"));
// NOTE: Simply use standard Java casting operators, and the native resource is
// auto casted to its "*Class" equivalent that implements all possible interfaces for that type.
// The following are all possible due to this multiple implementations of interfaces within
// the "*Class" version returned from methods when the Auto Class Cast feature is used
IAgScenario scen1 = (IAgScenario)m_AgStkObjectRoot.getCurrentScenario();
// or
IAgScenario scen2 = (AgScenarioClass)m_AgStkObjectRoot.getCurrentScenario();
// or
AgScenarioClass scen3 = (AgScenarioClass)m_AgStkObjectRoot.getCurrentScenario();
// NOTE: Simply use standard Java casting operators, and the native
// resource is auto casted to its "*Class" equivalent that implements all
// possible interfaces for that type.
IAgFacility fac1 = (IAgFacility)scen3.getChildren()._new(AgESTKObjectType.eFacility, "Fac1");
// or
IAgFacility fac2 = (AgFacilityClass)scen3.getChildren()._new(AgESTKObjectType.eFacility, "Fac1");
// or
AgFacilityClass fac3 = (AgFacilityClass)scen3.getChildren()._new(AgESTKObjectType.eFacility, "Fac1");
IAgStkObject acobj = scenario.getChildren().getItem(new AgVariant("F16"));
// or
IAgStkObject acobj = scenario.getChildren().getItem(new AgVariant(1));
IAgStkObject acobj = scenario.getChildren().getItem("F16");
// or
// If auto boxing IS NOT supported in your JRE version
IAgStkObject acobj = scenario.getChildren().getItem(new Integer(1));
// or
// If auto boxing IS supported in your JRE version
IAgStkObject acobj = scenario.getChildren().getItem(1);
AgVariant[] vars = new AgVariant[]
{
new AgVariant(39.88), new AgVariant(-75.25), new AgVariant(0), // Philadelphia
new AgVariant(38.85), new AgVariant(-77.04), new AgVariant(0), // Washington, D.C.
new AgVariant(29.98), new AgVariant(-90.25), new AgVariant(0), // New Orleans
new AgVariant(37.37), new AgVariant(-121.92), new AgVariant(0) // San Jose
};
AgSafeArray positions = new AgSafeArray(AgVariantTypes.VT_VARIANT, vars.length);
positions.setVariantArray(vars);
IAgStkGraphicsMarkerBatchPrimitive markerBatch = null;
markerBatch = manager.getInitializers().getMarkerBatchPrimitive().initializeDefault();
String filePath = DataPaths.getDataPaths().getSharedDataPath("Markers/facility.png");
markerBatch.setTexture(manager.getTextures().loadFromStringUri(filePath));
markerBatch.setCartographic("Earth", positions);
Object[] positions = new Object[]
{
new Double(39.88), new Double(-75.25), new Double(0), // Philadelphia
new Double(38.85), new Double(-77.04), new Double(0), // Washington, D.C.
new Double(29.98), new Double(-90.25), new Double(0), // New Orleans
new Double(37.37), new Double(-121.92), new Double(0) // San Jose
};
IAgStkGraphicsMarkerBatchPrimitive markerBatch = null;
markerBatch = manager.getInitializers().getMarkerBatchPrimitive().initializeDefault();
String filePath = DataPaths.getDataPaths().getSharedDataPath("Markers/facility.png");
markerBatch.setTexture(manager.getTextures().loadFromStringUri(filePath));
markerBatch.setCartographic("Earth", positions);
// NOTE: Use the method that returns an AgVariant,
// then call the getObject() method on the variant
// and then cast to the dervied object reference type.
AgVariant vStartTime = scenario.getStartTime();
String sStartTime = vStartTime.getString();
// NOTE: Use sibling methods with _AsObject suffixes
// and then cast to the dervied object reference type.
String startTime = (String)scenario.getStartTime_AsObject();
AgSafeArray markers = scenario.getVO().availableMarkerTypes();
int dimCount = markers.getDimCount();
short saType = markers.getVariantType();
int rowCount = markers.getRowCount();
int colCount = markers.getColumnCount();
// Single dimensional array (1D), determined by dimCount or rowCount of 1.
// If two dimensional array (2D), dimCount would be 2, but rowCount could be anything
// from 1 ... *
if( dimCount == 1 && rowCount == 1)
{
if(saType == AgVariantTypes.VT_VARIANT )
{
for( int colIndex = 0; colIndex < colCount; colIndex++ )
{
// Using only the 1D method for simplification.
AgVariant vMarkerType = markers.getVariant(colIndex);
String sMarkerType = (String)vMarkerType.getObject();
System.out.println("\t[" + colIndex + "] = " + sMarkerType);
}
}
}
// NOTE: Simply use standard Java casting operators from Object to String, Double, etc.
Object markers = scenario.getVO().availableMarkerTypes_AsObject();
// Using only the 1D method for simplification.
if(markers instanceof Object[])
{
Object[] markersArray = (Object[])markers;
int colCount = markers.length;
for(int colIndex = 0; colIndex < colCount; colIndex++)
{
String markerType = (String)markersArray[colIndex]);
System.out.println("\t[" + colIndex + "] = " + markerType);
}
}
else if(markers instanceof Object[][])
{
// Handle 2 dimensional array
}
Color awtColor = Color.BLACK;
long oleColor = AgAWTOLEColorTranslator.fromAWTtoOLE(awtColor);
AgGlobeCntrlClass globe = new AgGlobeCntrlClass();
globe.setBackColor(oleColor);
AgGlobeCntrlClass globe = new AgGlobeCntrlClass();
long oleColor = globe.getBackColor();
Color awtColor = AgAWTOLEColorTranslator.fromOLEtoAWT(oleColor);
STK Programming Interface 11.0.1