[英]Nasa Worldwind: How do you fix these weird run time exceptions?
Nasa Worldwind SDK has some examples that I wish to run. Nasa Worldwind SDK有一些我希望运行的例子。 There are two ways I am trying to run the examples provided in the SDK: 我尝试运行SDK中提供的示例有两种方法:
When I do option (1.) I successfully compile/run with no errors. 当我做选项(1.)我成功编译/运行没有错误。
When I do option (2.) I successfully compile but get run time errors: 当我做选项(2.)我成功编译但得到运行时错误:
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.). 由于许可和配置管理问题,我强烈希望选择选项(2.)。 Does anyone know how to fix these run time errors seen above? 有谁知道如何解决上面看到的这些运行时错误?
Ok..These are my Eclipse project steps under Windows environment: 好的..这些是我在Windows环境下的Eclipse项目步骤:
src
folder) 创建一个新的Eclipse项目(只要它有src
文件夹,空白项目就可以了) lib
folder under this project (under the root of the project folder) 在此项目下创建lib
文件夹(在项目文件夹的根目录下) lib
folder: gluegen-rt.jar, jogl.jar, worldwind.jar, jogl.dll, gluegen-rt.dll, jogl_awt.dll, jogl_cg.dll
将所需的库和DLL放入lib
文件夹: gluegen-rt.jar, jogl.jar, worldwind.jar, jogl.dll, gluegen-rt.dll, jogl_awt.dll, jogl_cg.dll
HelloWorlWind.java
into the src
folder 将示例HelloWorlWind.java
复制到src
文件夹中 lib
folder into the Referenced Libraries
tree by right-clicking on each jar and select Build Path > Add to Build Path
通过右键单击每个jar并选择Build Path > Add to Build Path
,将lib
文件夹中的所有JAR添加到Referenced Libraries
树中 jogl.jar
in the Referenced Libraries
tree and select Build Path > Configure Build Path
. 右键单击Referenced Libraries
树中的jogl.jar
,然后选择Build Path > Configure Build Path
。 It will pop up Properties
dialog box 它会弹出Properties
对话框 Properties
dialog box, go to Libraries tab
and expand jogl.jar
tree 在“ Properties
对话框中,转到“ Libraries tab
然后展开“ jogl.jar
树 Native library location
and click Edit
button on the right. 选择本Native library location
,然后单击右侧的“ Edit
按钮。 It will popup Native Library Folder Configuration
dialog box. 它将弹出Native Library Folder Configuration
对话框。 lib
folder as the location path by clicking on Workspace...
button. 通过单击Workspace...
按钮将lib
文件夹设置为位置路径。 Then, run HelloWorlWind.java
. 然后,运行HelloWorlWind.java
。 It will display the glorious Worldwind Earth without any exception! 它将毫无例外地展示辉煌的Worldwind Earth!
Take note: a few Worldwind example apps don't terminate the JVM after you close the GUI window. 请注意:关闭GUI窗口后,一些Worldwind示例应用程序不会终止JVM。
For the ApplicationTemplate.java
to work, make sure to copy the required dependencies: 要使ApplicationTemplate.java
正常工作,请确保复制所需的依赖项:
I have no problems from doing exactly what you describe in option 2, it works fine. 我完全按照你在选项2中描述的那样做了没有问题,它运行正常。 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. 使用新下载的WorldWind Java源代码副本时,应在使用WorldWind.jar文件之前执行Ant构建。 The WorldWind.jar file is not always upto date and can cause conflicts when being used. WorldWind.jar文件并不总是最新的,并且在使用时可能会导致冲突。
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. 基本上你从你的行为中描述的是:它在使用源代码时起作用,并且当它使用编译的代码时失败。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.