Let me preface this by saying I'm very new to Java, eclipse and worldwind.
So, I've got a bare bones java app. I imported worldwind.jar into the build path. Created a simple JFrame, code below, and added the following to the Project > properties > Run/Debug settings > Arguments > VM arguments :
-Djava.library.path=Path\To\My\Worldwind\Directory
Here is the JFrame source
public class TestMap extends JFrame {
private JPanel contentPane;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
TestMap frame = new TestMap();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public TestMap() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
JSplitPane splitPane = new JSplitPane();
contentPane.add(splitPane, BorderLayout.CENTER);
WorldWindowGLCanvas worldWindowGLCanvas = new WorldWindowGLCanvas();
splitPane.setRightComponent(worldWindowGLCanvas);
Model m = (Model)WorldWind.createConfigurationComponent(AVKey.MODEL_CLASS_NAME);
}
}
When I run the program, the worldwind panel is black, and i get exceptions streaming through the console output.
Apr 18, 2012 2:44:18 PM gov.nasa.worldwind.WorldWindowGLAutoDrawable display SEVERE: Exception while attempting to repaint WorldWindow java.lang.NullPointerException at gov.nasa.worldwind.render.DrawContextImpl.getGlobe(Unknown Source) at gov.nasa.worldwind.view.BasicView.apply(Unknown Source) at gov.nasa.worldwind.AbstractSceneController.applyView(Unknown Source) at gov.nasa.worldwind.BasicSceneController.doRepaint(Unknown Source) at gov.nasa.worldwind.AbstractSceneController.repaint(Unknown Source) at gov.nasa.worldwind.WorldWindowGLAutoDrawable.doDisplay(Unknown Source) at gov.nasa.worldwind.WorldWindowGLAutoDrawable.display(Unknown Source) at com.sun.opengl.impl.GLDrawableHelper.display(GLDrawableHelper.java:78) at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:288) at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:194) at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:265) at javax.media.opengl.GLCanvas.display(GLCanvas.java:130) at javax.media.opengl.GLCanvas.paint(GLCanvas.java:142) at sun.awt.RepaintArea.paintComponent(Unknown Source) at sun.awt.RepaintArea.paint(Unknown Source) at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$000(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(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) at java.awt.EventDispatchThread.run(Unknown Source)
Any idea what I'm doing wrong??
EDIT: Forgot to mention, I'm on a 64bit machine, I downloaded the AMD64 version of jogl and put the .dll's in the worldwind folder. That worked to get the demo app running.
System.out.println("Hello World!");