I am just getting started on an application that uses the World Wind Java SDK. As I learn more about it I will post tips and lessons, more for myself as a reminder of how I did something, but maybe someone else will find use of them. This lesson will be a very simple Hello World. I will explain how to get the WWJ SDK going in NetBeans in this article.

Note: I will update this article for Eclipse as well, as soon as VEP becomes available for the Europa release - why don't they have a Visual Editor built into the core? OK, I will save that for another blog subject, moving on...

The first thing we need to do of course is download and unzip the WWJ SDK - http://worldwind.arc.nasa.gov/java/

After you have that downloaded and unzipped the SDK we can set up our IDE.

For Netbeans 5.5.1:

  1. Open Netbeans.
  2. Add the WorldWindowGLCanvas to the palette.
    Choose Tools->Palette Manager->Swing/AWT Components. Click the Add from JAR button. Browse to the unzipped worldwind sdk directory and choose worldwind.jar, click Next. This will list all the JavaBeans inside the JAR, choose the WorldWindowGLCanvas, click Next. Choose Swing as the Palette Category, click Finish. Click Close on the Palette Manager.
  3. Create a new Java Project.
    Choose File -> New Project. Choose General - Java Application and Click next. Choose a project name, for the example I chose "HelloWorldWind", uncheck the "Create Main Class" check box, click Finish.Create new Java Project
  4. Add the libraries to your project.
    Right click on your newly created project from the project explorer frame and choose Properties. Choose libraries from the categories list. With the Compile tab selected, click Add JAR/Folder button. Browse to your unzipped worldwind directory and choose worldwind.jar. Now select the Run tab and add jogl.jar and gluegen-rt.jar. Click OK to close the Project Properties.Add the Libraries
  5. Add a JFrame Form to your project.
    Right click you project and choose New->JFrame Form. Enter a class name, I chose "HelloWorldWindMain", click finish.Add JFrame
  6. Add the WorldWindowGLCanvas to your JFrame.
    Simply drag and drop the WorldWindowGLCanvas from the palette onto the JFrame. Here you can resize the WorldWindowGLCanvas, so that it takes up the full JFrame.Add WorldWindGLCanvas
  7. Initialize the WorldwindowGLCanvas class.
    Click on the source tab. Add import gov.nasa.worldwind.*; to the source just below the first set of comments. Inside your HelloWorldWindMain() method, just after initComponents(); add the following:Model m = (Model) WorldWind.createConfigurationComponent(AVKey.MODEL_CLASS_NAME);
    worldWindowGLCanvas1.setModel(m);

    UPDATE: If you are using release 20070817 0 - you will also need to import:
    import gov.nasa.worldwind.avlist.AVKey;
  8. Add the VM command line options.
    The last step is telling our project where to find everything. Right click you project and choose Properties. With the Run category selected enter -Djava.library.path=/path/to/directory in the VM Options text box, click OK. Example: -Djava.library.path=C:\Users\george\Desktop\worldwindAdd VM command line options
  9. Run the Project. Choose Run->Run Main Project, or, hit F6. The first time you run it will ask you to select the main class, choose the HelloWorldWindMain, click OK.Run the project
  10. Success!