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.

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 11, 2007 at 10:25 PM 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 04: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 04: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 05:49 AM 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 04: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 03: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 13, 2007 at 11:03 PM 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 13, 2007 at 11:34 PM 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 08:19 AM 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 09:49 AM 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 10:02 AM PDT #

sweet

Posted by guest on May 15, 2007 at 01: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 02: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 04: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 02: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 02: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 02:15 AM PST #

Yes, just a normal Java class.

Posted by Geertjan on January 01, 2008 at 02: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 02: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 03:36 AM PST #

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

Posted by kevin on January 01, 2008 at 03: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 02:41 PM PDT #

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

Posted by khaled on November 06, 2008 at 10:01 AM PST #

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.

Posted by Suma on November 25, 2008 at 06:02 AM PST #

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>

Posted by Mark Young on February 17, 2009 at 10:46 PM PST #

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

Posted by Sanat on March 17, 2009 at 01:02 AM PDT #

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

Posted by green on July 10, 2009 at 06:21 AM PDT #

Has anyone else gotten
SEVERE: Exception while attempting to repaint WorldWindow
java.lang.NullPointerException

Posted by jayp on September 02, 2009 at 04:45 AM PDT #

mark n green,

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

how to resolve it?
thanks

Posted by sam22 on September 02, 2009 at 06:15 AM PDT #

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

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

Posted by sam22 on September 04, 2009 at 02:20 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today