Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  1. 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.
  2. 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 know how to fix these run time errors seen above?

like image 647
Trevor Boyd Smith Avatar asked Oct 12 '22 07:10

Trevor Boyd Smith


1 Answers

Ok..These are my Eclipse project steps under Windows environment:

  1. Create a new Eclipse project (a blank project is fine as long as it has the src folder)
  2. Create the lib folder under this project (under the root of the project folder)
  3. 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
  4. copy the sample HelloWorlWind.java into the src folder
  5. Add all JARs in the lib folder into the Referenced Libraries tree by right-clicking on each jar and select Build Path > Add to Build Path
  6. Right-click on jogl.jar in the Referenced Libraries tree and select Build Path > Configure Build Path. It will pop up Properties dialog box
  7. In Properties dialog box, go to Libraries tab and expand jogl.jar tree
  8. Select Native library location and click Edit button on the right. It will popup Native Library Folder Configuration dialog box.
  9. Set the lib folder as the location path by clicking on Workspace... 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
like image 128
eee Avatar answered Oct 14 '22 05:10

eee