由org.gdal.ogr.ogrJNI.GetDriverCount()引起的UnsatisfiedLinkError [英] UnsatisfiedLinkError caused by org.gdal.ogr.ogrJNI.GetDriverCount()

查看:275
本文介绍了由org.gdal.ogr.ogrJNI.GetDriverCount()引起的UnsatisfiedLinkError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Windows 7上使用Eclipse(Luna)在Java中进行开发.

I am developing in Java on Windows 7 with Eclipse (Luna).

我正在将gdal用于某些ogr进程,并且可以从eclipse运行应用程序,但是在同一台计算机上从命令行运行会出现问题.

I am using gdal for some ogr processes and running the application from eclipse is fine, but running from command line on the same machine is running into problems.

我得到以下信息:

Caused by: java.lang.UnsatisfiedLinkError: org.gdal.ogr.ogrJNI.GetDriverCount()I
    at org.gdal.ogr.ogrJNI.GetDriverCount(Native Method)
    at org.gdal.ogr.ogr.GetDriverCount(ogr.java:170)

我已将gdal下所有包含dll和jar的目录添加到CLASSPATHPATH环境中.

I've added all of the directories under gdal that contain dlls and jars to both the CLASSPATH and PATH environmental.

我以为可能是库,但是我在路径中使用了部署位置,该位置在eclipse中起作用.

I thought it might be the libraries, but I am using the deployment location in the paths, which works in eclipse.

在eclipse项目的.classpath文件中,我注意到gdal引用具有一个名为CLASSPATH_ATTR_LIBRARY_PATH_ENTRY的属性,该属性链接到gdal \ dll目录,但是我已经将其包含在路径中:

In the eclipse project's .classpath file I noticed that the gdal reference has an attribute called CLASSPATH_ATTR_LIBRARY_PATH_ENTRY, this links to the gdal\dll directory, but I have already included that in the paths:

<classpathentry exported="true" kind="lib" path="dependencies/gdal/bin/gdal/java/gdal.jar">
    <attributes>
        <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="dependencies/gdal/dll"/>
    </attributes>
</classpathentry>

这是我唯一能看到的区别.您如何在Windows计算机上复制此文件,或者由CLASSPATH和PATH处理?

This is the only difference I can see. How do you replicate this on a windows machine or is that handled by the CLASSPATH and PATH?

我需要引用各个dll吗?我已经尝试了通常与gdal.jar一起使用的4,但这并没有改变我得到的错误.

Do I need to reference the individual dlls? I have tried the 4 that normally go with gdal.jar, but that doesnt change the error that I am getting.

推荐答案

我找到了这篇文章/发表: http://sandbox.idre.ucla.edu/sandbox/tutorial /installing-gdal-for-windows

I found this article / Post: http://sandbox.idre.ucla.edu/sandbox/tutorial/installing-gdal-for-windows

它讨论了为Windows设置GDAL,比我拥有的包含和引用的蜘蛛网要直接得多.

It talks about setting up GDAL for windows and is a lot more straight forward than the spiders web of includes and references I had.

我从ClassPath和Path中删除了对gdal的所有引用.

I took all the references to gdal off the ClassPath and Path.

然后,我仅在ClassPath上添加到gdal/bin/gdal/java/gdal.jar的链接,并在路径上添加到gdal/dll目录的链接.就是...这就是您需要做的...

I then added only the link to the gdal/bin/gdal/java/gdal.jar on the ClassPath and a link to gdal/dll directory on the Path. That is it... that is all you need to do...

帖子中有关于GDAL_DATAGDAL_DRIVERS的提及,我并不需要,但是您可以添加它们以确保安全.

There are mentions in the post about GDAL_DATA and GDAL_DRIVERS, I didnt need those, but you could add those to be safe.

更新 GDAL_DATA是必需的,只需引用gdal/bin/gdal_data iirc

update GDAL_DATA is needed, just reference gdal/bin/gdal_data iirc

我只能推断Eclipse不使用类路径,因此我在ClassPath上添加的额外引用只是令人困惑.

I can only deduce that Eclipse doesnt use the classpath so the extra references I put on the ClassPath were just confusing matters.

这篇关于由org.gdal.ogr.ogrJNI.GetDriverCount()引起的UnsatisfiedLinkError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆