Nasa Worldwind: How do you fix these weird run time exceptions?
Nasa Worldwind SDK has some examples that I wish to run. There are two ways I am trying to run the examples provided in the SDK:
- Create an Eclipse project using the entire SDK source folder.
- point to all the worldwind dependencies (*.jar and *.dll files)
- Go to the folder with examples: src\gov\nasa\worldwind\examples.
- Run the example ApplicationTemplate.java main.
- Create an Eclipse project that is empty.
- point to all the worldwind dependencies (*.jar and *.dll files)
- point to worldwind.jar
- Then copy the examples folder into my Eclipse project.
- Refactor all the packages that are listed as gov.nasa.worldwind.examples to examples.
- Run the example ApplicationTemplate.java main.
When I do option (1.) I successfully compile/run with no errors.
When I do option (2.) I successfully compile but get run time errors:
Apr 13, 2011 12:18:35 PM gov.nasa.worldwind.WorldWind createComponent
SEVERE: Exception while creating World Wind component gov.nasa.worldwind.cache.BasicDataFileStore
Apr 13, 2011 12:18:35 PM gov.nasa.worldwind.WorldWind createConfigurationComponent
SEVERE: Unable to create class for configuration key gov.nasa.worldwind.cache.BasicDataFileStore
Exception in thread "main" java.lang.ExceptionInInitializerError
at gov.nasa.worldwind.awt.WorldWindowGLCanvas.<init>(Unknown Source)
at Main2.main(Main2.java:15)
Caused by: java.lang.IllegalStateException: Unable to create class for configuration key gov.nasa.worldwind.cache.BasicDataFileStore
at gov.nasa.worldwind.WorldWind.createConfigurationComponent(Unknown Source)
at gov.nasa.worldwind.WorldWind.initialize(Unknown Source)
at gov.nasa.worldwind.WorldWind.<init>(Unknown Source)
at gov.nasa.worldwind.WorldWind.<clinit>(Unknown Source)
... 2 more
Caused by: gov.nasa.worldwind.exception.WWRuntimeException: Exception while creating World Wind component gov.nasa.worldwind.cache.BasicDataFileStore
at gov.nasa.worldwind.WorldWind.createComponent(Unknown Source)
... 6 more
Caused by: java.lang.NullPointerException
at gov.nasa.worldwind.cache.BasicDataFileStore.<init>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
... 7 more
Due to licensing and configuration management issues, I would STRONGLY PREFER to go with Option (2.). Does anyone k开发者_Go百科now how to fix these run time errors seen above?
Ok..These are my Eclipse project steps under Windows environment:
- Create a new Eclipse project (a blank
project is fine as long as it has
the
src
folder) - Create the
lib
folder under this project (under the root of the project folder) - Put required libraries and DLLs into
the
lib
folder:gluegen-rt.jar, jogl.jar, worldwind.jar, jogl.dll, gluegen-rt.dll, jogl_awt.dll, jogl_cg.dll
- copy the sample
HelloWorlWind.java
into thesrc
folder - Add all JARs in the
lib
folder into theReferenced Libraries
tree by right-clicking on each jar and selectBuild Path > Add to Build Path
- Right-click on
jogl.jar
in theReferenced Libraries
tree and selectBuild Path > Configure Build Path
. It will pop upProperties
dialog box - In
Properties
dialog box, go toLibraries tab
and expandjogl.jar
tree - Select
Native library location
and clickEdit
button on the right. It will popupNative Library Folder Configuration
dialog box. - Set the
lib
folder as the location path by clicking onWorkspace...
button.
Then, run HelloWorlWind.java
. It will display the glorious Worldwind Earth without any exception!
Take note: a few Worldwind example apps don't terminate the JVM after you close the GUI window.
For the ApplicationTemplate.java
to work, make sure to copy the required dependencies:
- ClickAndGoSelectListener.java
- LayerPanel.java
I have no problems from doing exactly what you describe in option 2, it works fine. When using a freshly downloaded copy of the WorldWind Java source code, you should do an Ant Build it before using the WorldWind.jar file. The WorldWind.jar file is not always upto date and can cause conflicts when being used.
Basically what you describe from your actions is this: It works when it is using the source code, and that it fails when it is using the compiled code.
精彩评论