WWJava in NetBeans IDE

(0.6 SDK era) Tracking WWJava SDK versions from NetBeans
Chiss' instructions (0.5 SDK era, see below) for initial NetBeans build remain an excellent help for building a 0.6 WWJava SDK using NetBeans 6.9.1 and 32-bit version of the JDK 1.6.0_22 on a Windows 7 64-bit machine. If you're building the WWJava SDK for the first time, follow those instructions and add 'gdal.jar' at the same time you're adding 'gluegen-rt.jar' and 'jogl.jar' via the 'Add JAR/Folder' button.

The WWJava team doesn't publish a CM repository as of December 2010. It uses Subversion (SVN) internally. There's plenty of discussion on this subject in the forums if you're interested. If you'd like to effectively track WWJava builds releases externally using Mercurial, keep reading this section. These instructions assume you're familiar with Mercurial, its integration with NetBeans, and that you've already committed an initial version of the WWJava SDK to a Mercurial repository inside NetBeans:
 * Download the desired SDK version from the WWJava releases site.
 * Extract the zip file to a local directory, not in your Mercurial source tree yet.
 * Rename top level 'build.xml' to 'build_ww.xml' (see the 0.5 SDK era explanation for why).
 * When pulling new versions of WWJava, be careful to properly reflect file deletes (keep reading for suggestions on how to do this). If you don't properly track file deletes, WWJava SDK compile errors will be extremely difficult to identify.
 * Use WinMerge (or some similar directory comparison tool) to figure out which files have been deleted since your prior committed version of the WWJava SDK.
 * Delete these files (if any) from Mercurial on your source tree. You will commit these deletes later in a step below, once you've confirmed that the build works.
 * Copy and replace the new source tree onto the existing (Mercurial controlled) source tree.
 * In NetBeans, Clean & Build the project.
 * Verify that only expected warnings occur - fix these as you wish against your local Mercurial repository.
 * Commit the new/modified/deleted source files to Mercurial, using the WWJava published release version number in your commit comment.

(0.5 SDK era) Compiling and running the SDK examples
This step by step guide was created with NetBeans 6.x and the 0.5.0 release of the SDK. However, the general principals outlined here should work regardless of the SDK version.


 * Unzip the SDK
 * Open NetBeans and create a New Project using the "Java Application" template. Fill in the required details but uncheck the 'Create Main class' box. Your new project should reside in a clean directory.
 * Rename WorldWind's 'build.xml' to something else (build_ww.xml) and copy all the WorldWind's unzipped content to your NetBeans project folder so that the src folders overlap. You should end up with a folder structure very similar to the WorldWind unzipped folder, plus a 'nbproject' and a 'test' folders. The 'build.xml' file is the one created by NetBeans, not the one that came with the zip (which is why we renamed it earlier).
 * From NetBeans, you will notice that some folders/classes are marked with a red exclamation mark. We now need to tell the project about the required libraries. Right-click your project's node and select 'Properties' (typically the last menu item). Select the 'Libraries' node from the Categories tree and press the 'Add JAR/folder' button on the right. Keeping CTRL down, select the 'gluegen-rt.jar' and 'jogl.jar' that are now inside your project folder. Click 'ok'.
 * At this point, only 2 classes in the '...examples.Applet' package don't compile (still have the red exclamation mark). Go back to the 'Libraries' category like before, but this time you need to add the 'plugin.jar' located in your JDK/jre/lib directory (for example, C:\Program Files\Java\jdk1.6.0_10\jre\lib\plugin.jar)

You can now run any of the examples by right-clicking them and selecting 'Run File' from the contextual menu.

(0.1 SDK era) Original entry from Geertjan's log when the 0.1 SDK was initially released
Now that the worldwind.jar for NASA World Wind is available, here's the absolutely simplest scenario that you can implement very quickly and efficiently with NetBeans IDE:

-Djava.library.path=/path/to/unzipped/nasa/download public class WWHelper { private WWHelper { }   public static void setup(final WorldWindow ww) { Model m = (Model) WorldWind.createConfigurationComponent(AVKey.MODEL_CLASS_NAME); ww.setModel(m); } } WWHelper.setup(worldWindowGLCanvas1);
 * Download and unzip the World Wind Java SDK.
 * In NetBeans IDE, select Tools / Palette Manager from the main menu. In the Swing/AWT Components Palette Manager, browse to the worldwind.jar. Select WorldWindowGLCanvas component and add it to the Beans category.
 * Create a new Java application in NetBeans IDE. Open the Project Properties dialog box. In the Libraries tab, put the worldwind.jar on the compile time classpath. Put jogl.jar and gluegen-rt.jar, which are both in the World Wind Java SDK you downloaded, on the runtime classpath.
 * Again within the Project Properties dialog box, use the Run tab to add a line such as the following in the VM Options text field:
 * Create a JFrame in your application. Drag and drop the WorldWindowGLCanvas from the palette onto the JFrame and, if you like, resize to cover the whole JFrame, with this result:
 * Create a helper class, with this very basic content:
 * Then, back in the JFrame, add this line after the initComponents, in the constructor:
 * Run the application. Let the JFrame's constructor be the application's starting point. Here's what you should see:
 * Use the mouse, or your keyboard's alternative, for panning and zooming:

This is the start of a series of blog entries on this topic. And a NetBeans tutorial will follow, as well as related NetBeans modules, such as templates and so on. With thanks to Ken Russell for help and support.

Source: Geertjan's Weblog