This lesson will be a very simple Hello World demonstrating the Nasa World Wind Java SDK. I will explain how to get the WWJ SDK going in NetBeans 5.5.1 in this article. Before we get started you need to make sure that you download and unzip the World Wind SDK - Java World Wind SDK.


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
Create the 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
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
Add a 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
Add WorldWindowGLCanvas

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);

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
VM command 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!

World Wind Example
For this and more examples and tutorials


worldwind-1.jpg Info on worldwind-1.jpg 71974 bytes
worldwind-2.jpg Info on worldwind-2.jpg 95446 bytes
worldwind-3.jpg Info on worldwind-3.jpg 76445 bytes
worldwind-4.jpg Info on worldwind-4.jpg 69443 bytes
worldwind-5.jpg Info on worldwind-5.jpg 75389 bytes
worldwind-6.jpg Info on worldwind-6.jpg 59112 bytes
worldwind-7.jpg Info on worldwind-7.jpg 90409 bytes


Referenced by: