我正在尝试使用 LTE-CIVIL,我刚刚获得库并将 no-swt.jar 和 native win32 .jar 添加到我在 Eclipse 中的项目中,但出现此错误。知道如何解决此错误。我只是想运行项目附带的示例代码。
Exception in thread "main" com.lti.civil.CaptureException:java.lang.UnsatisfiedLinkError: no civil in java.library.path at com.lti.civil.impl.jni.NativeCaptureSystemFactory.createCaptureSystem(NativeCaptureSystemFactory.java:24)at com.lti.civil.test.CaptureSystemTest.main(CaptureSystemTest.java:33)Caused by: java.lang.UnsatisfiedLinkError: no civil in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source)at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source)at com.lti.civil.impl.jni.NativeCaptureSystemFactory.createCaptureSystem(NativeCaptureSystemFactory.java:21)
最佳答案
当您的应用程序使用任何 native 库或 dll 时,通常会出现此错误。要解决此问题,您必须将 dll 添加到 java.library.path 变量中。 就像如果您的 native dll 是 C:/Work/lti-civil/native/win32-x86 中的 presnet 那么您必须添加 在使用任何民事类(class)之前遵循代码
System.setProperty( "java.library.path", "C:/Work/lti-civil/native/win32-x86/" );
Field fieldSysPath = ClassLoader.class.getDeclaredField( "sys_paths" );
fieldSysPath.setAccessible( true );
fieldSysPath.set( null, null );
它将您的 dll 加载到您的应用程序中。
关于java - Eclipse 中的 LTE-CIVIL UnsatisfiedLinkError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13465839/