X

Geertjan's Blog

  • May 12, 2007

Hello NASA World Wind

Geertjan Wielenga
Product Manager
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.

Join the discussion

Comments ( 30 )
  • peter Saturday, May 12, 2007
    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.
  • Bull_UK Saturday, May 12, 2007
    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.
  • Geertjan Saturday, May 12, 2007
    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).

  • m_k Saturday, May 12, 2007
    OK, it's wikified
    http://www.worldwindcentral.com/wiki/WWJava_in_NetBeans_IDE
    Thanks again
  • Classicning Clog Saturday, May 12, 2007
    [Trackback] 原文地址:
    http://blogs.sun.com/geertjan/entry/hello_nasa_world_wind

    NASA World Wind的worldwind.jar已经正式发布, 下面我们来看一些最简单的 例子,这些例子都可以在NetBeans中快速和敏捷地实现。
  • Orlando Warren Sunday, May 13, 2007
    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?
  • Geertjan Monday, May 14, 2007
    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.)
  • Geertjan Monday, May 14, 2007
    Orlando, I think your problem is that you don't have JOGL in your library path. Look at step 4 above for details.
  • Orlando Warren Monday, May 14, 2007
    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.
  • Geertjan Monday, May 14, 2007
    Can you post the entire error message here? Not just what you posted before, but everything...
  • Geertjan Monday, May 14, 2007
    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.
  • guest Tuesday, May 15, 2007
    sweet
  • vincecrue Thursday, May 17, 2007
    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/
  • Mario Saturday, May 19, 2007
    I got the empty black canvas inside the JFrame, without the errors. BasicDemo works fine.
  • luigi Tuesday, October 30, 2007

    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?


  • Geertjan Tuesday, October 30, 2007

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


  • Kevin Tuesday, January 1, 2008

    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.


  • Geertjan Tuesday, January 1, 2008

    Yes, just a normal Java class.


  • Kevin Tuesday, January 1, 2008

    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)


  • Kevin Tuesday, January 1, 2008

    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)


  • kevin Tuesday, January 1, 2008

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


  • utkarsh Wednesday, May 14, 2008

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


  • khaled Thursday, November 6, 2008

    I followed all the steps and get it to run except that it does not zoom or pan. Am I missing something?


  • Suma Tuesday, November 25, 2008

    Just came across this nice tutorial. I do have WWJ working within NetBeans, however, I am unable to successfully launch it as an applet in my web application. I get series of link errors. I moved the native dlls to my JRE installation lib/ext folder, included them within my webapp directory..but, no luck.

    Kindly let me know any suggestions,

    Thanks, Suma.


  • Mark Young Wednesday, February 18, 2009

    My Netbeans 6.5 JFrame initComponemts()

    The .addComponent(..) and

    the .addContainerGap(...)

    are giving errors of "cannot find symbol"

    Any ideas.

    mark

    private void initComponents() {

    worldWindowGLCanvas1 = new gov.nasa.worldwind.awt.WorldWindowGLCanvas();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

    getContentPane().setLayout(layout);

    layout.setHorizontalGroup(

    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

    .addGroup(layout.createSequentialGroup()

    .addContainerGap()

    .addComponent(worldWindowGLCanvas1, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)

    .addContainerGap())

    );

    layout.setVerticalGroup(

    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

    .addGroup(layout.createSequentialGroup()

    .addContainerGap()

    .addComponent(worldWindowGLCanvas1, javax.swing.GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)

    .addContainerGap())

    );

    pack();

    }// </editor-fold>


  • Sanat Tuesday, March 17, 2009

    Hi,

    I may sound a bit out of context but it is related. Could anyone enlighten on the best 3D library for Netbeans platform applications. I have had problems with GLJPanel of JOGL on my Ubuntu Box.

    Regards,

    Sanat


  • green Friday, July 10, 2009

    Mark,

    Did you ever resolve that issue? I am running into that same problem using NetBeans 6.5


  • jayp Wednesday, September 2, 2009

    Has anyone else gotten

    SEVERE: Exception while attempting to repaint WorldWindow

    java.lang.NullPointerException


  • sam22 Wednesday, September 2, 2009

    mark n green,

    I too got the same 'symbol not found' with addcomponent am using NeBeans6.7.1

    how to resolve it?

    thanks


  • sam22 Friday, September 4, 2009

    I was able to resolve the issue pls follow the below link

    http://forum.worldwindcentral.com/showthread.php?p=73862


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha