Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
    
I think I see the problem... there is no System.out.println("Hello World!"); –  blah238 May 19 '12 at 18:04

2 Answers 2

Maybe this can help you: http://acuriousanimal.com/blog/2011/03/10/how-to-create-a-cross-platform-application-with-nasa-worldwind-netbeans-platform/

Very, long time ago I work with WWJ :)

From what I can see you must set the model to the WWJ instance:

Model model = (Model)WorldWind.createConfigurationComponent(AVKey.MODEL_CLASS_NAME);
WorldWindowGLCanvas wwj = new WorldWindowGLCanvas();
wwj.setModel(model);

or

WorldWindowGLCanvas worldWindCanvas = new WorldWindowGLCanvas();
worldWindCanvas.setModel(new BasicModel());
share|improve this answer

This sounds like a graphics driver problem. I saw this behavior when I tried to run a worldwind app on a machine with just the standard windows 7 graphics driver. Upgrading to the latest nvidia driver (because the machine had an invidia card) solved this issue.

With worldwind 2, you can just double-click the worldwindx jar and if there are troubles messages will pop up telling you what functions are missing.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.