Download NetBeans!

20070512 Saturday May 12, 2007

Hello NASA World Wind

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:

  1. Download and unzip the World Wind Java SDK.

  2. 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.

  3. 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.

  4. 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:

    -Djava.library.path=/path/to/unzipped/nasa/download

  5. 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:

  6. Create a helper class, with this very basic content:

    public class WWHelper {
        
        private WWHelper() {
        }
    
        public static void setup(final WorldWindow ww) {
            Model m = (Model) WorldWind.createConfigurationComponent(AVKey.MODEL_CLASS_NAME);
            ww.setModel(m);
        }
    }

    Then, back in the JFrame, add this line after the initComponents(), in the constructor:

    WWHelper.setup(worldWindowGLCanvas1);

  7. 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.

In other news. Check out the NetBeans On The Road 2007 hometown contest. If you win, you'll find those dusty NetBeans delivery guys on your doorstep, fresh from their recent Palestinian adventures, as recorded on http://netbeans.tv. Could be pretty cool if you enter together with a bunch of other people, such as from your college or JUG, because from what I hear those guys like to party.

May 12 2007, 03:45:11 AM PDT Permalink

Trackback URL: http://blogs.sun.com/geertjan/entry/hello_nasa_world_wind
Comments:

I noticed the requirements state that updated 3D video card drivers are required. I'm running the latest Solaris 10 with all updates on an Ultra 80 with 2x Elite M6, 4GB Ram, 4X450 MHz UltrasparcII and CrystalEyes 3 stereo glasses, but alas I get the blank screen. It would look very cool in Stereo.

Posted by peter on May 12, 2007 at 05:25 AM PDT #

Cool, can we copy this information on to the World Wind Java wiki? http://www.worldwindcentral.com/wiki/Java it would be extremely useful for new developers.

Posted by Bull_UK on May 12, 2007 at 11:18 AM PDT #

Sure, Bull_UK, go ahead. I'm new to the whole World Wind world... but am hoping to get comfortable, so check out my blog in the next days for more new code on this story.

peter, sorry to hear that. I'm using NVidia on Ubuntu 7.04 without any problems (knock on wood).

Posted by Geertjan on May 12, 2007 at 11:47 AM PDT #

OK, it's wikified http://www.worldwindcentral.com/wiki/WWJava_in_NetBeans_IDE Thanks again

Posted by m_k on May 12, 2007 at 12:49 PM PDT #

[Trackback] 原文地址:
http://blogs.sun.com/geertjan/entry/hello_nasa_world_wind

NASA World Wind的worldwind.jar已经正式发布, 下面我们来看一些最简单的 例子,这些例子都可以在NetBeans中快速和敏捷地实现。

Posted by Classicning Clog on May 12, 2007 at 11:24 PM PDT #

I'm on a macbook pro. I've gone through the steps in NetBeans. I added public static void main(String[] args) { new WWTopComponent(); } to the WWTopComponent (the JPanel), but when I run, I get something that doesn't render. I also get this in my NetBeans output: 2007-05-13 22:22:56.276 java[3215] CFLog (0): CFMessagePort: bootstrap_register(): failed 1103 (0x44f), port = 0x12e03, name = 'java.ServiceProvider' See /usr/include/servers/bootstrap_defs.h for the error codes. 2007-05-13 22:22:56.277 java[3215] CFLog (99): CFMessagePortCreateLocal(): failed to name Mach port (java.ServiceProvider) Any ideas what I'm doing wrong?

Posted by Orlando Warren on May 13, 2007 at 10:37 PM PDT #

Orlando, first, can you follow the instructions in this blog exactly as described? i.e., I didn't mention anything about a WWTopComponent or whatever you did. Follow the instructions exactly and then see if it works. After that, once the tutorial works for you, you can try and experiment with other approaches. But I can't help you if you do something different, because I have no way of knowing exactly what you did. (Also, if your video card driver is not up to date, the example is guaranteed to fail.)

Posted by Geertjan on May 14, 2007 at 06:03 AM PDT #

Orlando, I think your problem is that you don't have JOGL in your library path. Look at step 4 above for details.

Posted by Geertjan on May 14, 2007 at 06:34 AM PDT #

I do have JOGL set up as per the instructions. I called my JFrame 'WWTopComponent' for a lack of better name...I thought that is what you called your JFrame (from the image following step 5). I am able to run the demo that came with the worldwind download, so my video card driver is ok. I included a main method to my JFrame class that invokes the constructor.

Posted by Orlando Warren on May 14, 2007 at 03:19 PM PDT #

Can you post the entire error message here? Not just what you posted before, but everything...

Posted by Geertjan on May 14, 2007 at 04:49 PM PDT #

By the way you shouldn't need to include "a main method to my JFrame class that invokes the constructor". I don't understand what you're doing there. Use the JFrame's constructor as the starting point of your application, as pointed out above. You should just have two classes. The JFrame and the WWHelper. If you follow the steps exactly as stated above, it is easier for me to debug your problem.

Posted by Geertjan on May 14, 2007 at 05:02 PM PDT #

sweet

Posted by 72.47.27.140 on May 15, 2007 at 08:05 AM PDT #

It works pretty cool, but Wind World needs more geographical data!(in Google Earth you can zoom much closer into cities or other places!). Somehow it reminds me to the open source project Xplanet at http://xplanet.sourceforge.net/

Posted by vincecrue on May 17, 2007 at 09:59 AM PDT #

I got the empty black canvas inside the JFrame, without the errors. BasicDemo works fine.

Posted by Mario on May 19, 2007 at 11:21 AM PDT #

i also have the same problem as Mario.. bith worldwind 1.4 and the basic demo that comes with WW java jdk works fine but when i follow all the steps mentioned above all i get is a black screen with dots and only dots.. can you please suggest what the problem might be?

Posted by luigi on October 30, 2007 at 09:54 AM PDT #

I think it is best to write to nbusers@netbeans.org with this question.

Posted by Geertjan on October 30, 2007 at 09:58 AM PDT #

Are you using Netbeans 5.5.1 in this turorial? I am having problems too with this, I emailed netbeans.org about the problem and they have no idea.

When you say create a helper class, do you mean create a new "java class" with the name of "WWHelper"? Because I cannot find anything that refers to a helper class.

Posted by Kevin on January 01, 2008 at 10:15 AM PST #

Yes, just a normal Java class.

Posted by Geertjan on January 01, 2008 at 10:23 AM PST #

Here is the error im getting:

init:
deps-jar:
Created dir: /home/kevin/WWJTEST/build/classes
Compiling 3 source files to /home/kevin/WWJTEST/build/classes
/home/kevin/WWJTEST/src/wwjtest/WWHelper.java:21: cannot find symbol
symbol : class WorldWindow
location: class wwjtest.WWHelper
public static void setup(final WorldWindow ww) {
/home/kevin/WWJTEST/src/wwjtest/NewJFrame.java:18: cannot find symbol
symbol : variable worldWindowGLCanvas1
location: class wwjtest.NewJFrame
WWHelper.setup(worldWindowGLCanvas1);
/home/kevin/WWJTEST/src/wwjtest/WWHelper.java:22: cannot find symbol
symbol : class Model
location: class wwjtest.WWHelper
Model m = (Model) WorldWind.createConfigurationComponent(AVKey.MODEL_CLASS_NAME);
/home/kevin/WWJTEST/src/wwjtest/WWHelper.java:22: cannot find symbol
symbol : class Model
location: class wwjtest.WWHelper
Model m = (Model) WorldWind.createConfigurationComponent(AVKey.MODEL_CLASS_NAME);
/home/kevin/WWJTEST/src/wwjtest/WWHelper.java:22: cannot find symbol
symbol : variable AVKey
location: class wwjtest.WWHelper
Model m = (Model) WorldWind.createConfigurationComponent(AVKey.MODEL_CLASS_NAME);
/home/kevin/WWJTEST/src/wwjtest/WWHelper.java:22: cannot find symbol
symbol : variable WorldWind
location: class wwjtest.WWHelper
Model m = (Model) WorldWind.createConfigurationComponent(AVKey.MODEL_CLASS_NAME);
6 errors
BUILD FAILED (total time: 1 second)

Posted by Kevin on January 01, 2008 at 10:27 AM PST #

Here is the error im getting:

init:
deps-jar:
Created dir: /home/kevin/WWJTEST/build/classes
Compiling 3 source files to /home/kevin/WWJTEST/build/classes
/home/kevin/WWJTEST/src/wwjtest/WWHelper.java:21: cannot find symbol
symbol : class WorldWindow
location: class wwjtest.WWHelper
public static void setup(final WorldWindow ww) {
/home/kevin/WWJTEST/src/wwjtest/NewJFrame.java:18: cannot find symbol
symbol : variable worldWindowGLCanvas1
location: class wwjtest.NewJFrame
WWHelper.setup(worldWindowGLCanvas1);
/home/kevin/WWJTEST/src/wwjtest/WWHelper.java:22: cannot find symbol
symbol : class Model
location: class wwjtest.WWHelper
Model m = (Model) WorldWind.createConfigurationComponent(AVKey.MODEL_CLASS_NAME);
/home/kevin/WWJTEST/src/wwjtest/WWHelper.java:22: cannot find symbol
symbol : class Model
location: class wwjtest.WWHelper
Model m = (Model) WorldWind.createConfigurationComponent(AVKey.MODEL_CLASS_NAME);
/home/kevin/WWJTEST/src/wwjtest/WWHelper.java:22: cannot find symbol
symbol : variable AVKey
location: class wwjtest.WWHelper
Model m = (Model) WorldWind.createConfigurationComponent(AVKey.MODEL_CLASS_NAME);
/home/kevin/WWJTEST/src/wwjtest/WWHelper.java:22: cannot find symbol
symbol : variable WorldWind
location: class wwjtest.WWHelper
Model m = (Model) WorldWind.createConfigurationComponent(AVKey.MODEL_CLASS_NAME);
6 errors
BUILD FAILED (total time: 1 second)

Posted by Kevin on January 01, 2008 at 11:36 AM PST #

sorry about the double post, it said comment authentication failed.

Posted by kevin on January 01, 2008 at 11:37 AM PST #

i created two files by the name of
WWTopComponent.java - containing code for JForm, and
WWHelper.java - containing code for Helper class
this was the error i got after running the project:

init:
deps-jar:
compile:
run:
java.lang.NoClassDefFoundError: wind
Exception in thread "main"
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)

on further checking, i found the following errors in the private initComponents() - generated by the Form Editor

cannot find symbol
symbol: method add(gov.nasa.worldwind.awt.WorldWindowGLCanvas,int,int,short)
location: class org.jdesktop.layout.GroupLayout.SequentialGroup

cannot find symbol
symbol: method addContainerGap()
location: class org.jdesktop.layout.GroupLayout.SequentialGroup.add

PLEASE HELP!!!!!

Posted by utkarsh on May 14, 2008 at 09:41 PM PDT #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed