问题描述
我使用AspriseOCR制作了一个Java OCR程序。它需要一个名为AspriseOCR.dll的.dll,我将dll复制到C:/ Windows / System32 /
但是当我使用
System.load( C:/Windows/System32/AspriseOCR.dll);
我仍然收到一个UnsatisfiedLinkError。
我花了最近2天寻找解决问题的办法,但是找不到任何有用的东西。
如果任何人从Asprise需要帮助OCR引擎,我将尽力帮助您!
要加载库,如DLL,您应该使用
System.loadLibrary(libname);
其中libname
是名称。您不包括其存储的文件的扩展名或文件的完整路径。对于您的情况,您可能会调用
System.loadLibrary(AspriseOCR);
加载您正在使用的图书馆。
因为 loadLibrary
需要一个参数的库名称,而不是一个文件,您必须小心放置.dll。通常,您可以将其包含在应用程序的工作目录中,或者在本地文件夹(如System32)中。如果你必须把它放在别的地方,一定要适当地设置 java.libary.path
。例如,如果.dll位于文件夹库中,则应该使用参数
-Djava.library启动java .path = libraries
I made a Java OCR program using the AspriseOCR.It requires a .dll called AspriseOCR.dll, I copied the dll to C:/Windows/System32/But when I use
System.load("C:/Windows/System32/AspriseOCR.dll");
I still get a UnsatisfiedLinkError.
I've spent the last 2 days searching for a solution to my problem, but I couldn't find anything that works.
Okay everyone, it works now. Turns out I also had to make a 32-bit version!If anyone ever needs help with the OCR Engine from Asprise, pm and I'll try to help you!
To load libraries, such as DLLs, you should use
System.loadLibrary("libname");
Where "libname"
is the name of the library. You do not include the extension of the file it is stored in, or the full path to the file. For your case, you would probably call
System.loadLibrary("AspriseOCR");
to load the library you are using.
Because loadLibrary
takes a library name for an argument, not a file, you must be careful where you place the .dll. Normally, you could include it in the working directory of the application, or in a native folder such as System32. If you must put it somewhere else, be sure to appropriately set java.libary.path
. For example, if the .dll is in the folder "libraries", you should launch java with the argument
-Djava.library.path=libraries
这篇关于无法加载.dll与System.load(路径);的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!