2016-04-07 38 views
0

我正在使用Java調用System.loadLibrary()的庫來加載一些本地代碼,該代碼被編譯爲C擴展名爲.so的C共享庫。沒有什麼重要的,我已經做到了,並且工作(在Android和Mac OS X上)。是什麼導致System.loadLibrary()在Linux(RPi)上失敗?

我遇到的問題是,當在Raspberry Pi(Raspbian Distrobution)上運行時,java應用程序無法加載.so文件。

這是什麼原因導致它失敗,我該如何解決。

爲清楚:

  • 我知道我需要加載的二進制文件的正確架構。對於Raspberry Pi,我使用的二進制文件爲linux-arm
  • 我也設置了正確的路徑,所以應該找到它。我已經設置LD_LIBRARY_PATHjava.library.path沒有成功

更新1:

由於pcarter曾建議,我一直在使用-verbose:jni嘗試。雖然目前沒有出現任何錯誤,但請參閱此輸出:

[Dynamic-linking native method java.lang.Object.registerNatives ... JNI] 
[Registering JNI native method java.lang.Object.hashCode] 
[Registering JNI native method java.lang.Object.wait] 
[Registering JNI native method java.lang.Object.notify] 
[Registering JNI native method java.lang.Object.notifyAll] 
[Registering JNI native method java.lang.Object.clone] 
[Dynamic-linking native method java.lang.System.registerNatives ... JNI] 
[Registering JNI native method java.lang.System.currentTimeMillis] 
[Registering JNI native method java.lang.System.nanoTime] 
[Registering JNI native method java.lang.System.arraycopy] 
[Dynamic-linking native method java.lang.Thread.registerNatives ... JNI] 
[Registering JNI native method java.lang.Thread.start0] 
[Registering JNI native method java.lang.Thread.stop0] 
[Registering JNI native method java.lang.Thread.isAlive] 
[Registering JNI native method java.lang.Thread.suspend0] 
[Registering JNI native method java.lang.Thread.resume0] 
[Registering JNI native method java.lang.Thread.setPriority0] 
[Registering JNI native method java.lang.Thread.yield] 
[Registering JNI native method java.lang.Thread.sleep] 
[Registering JNI native method java.lang.Thread.currentThread] 
[Registering JNI native method java.lang.Thread.countStackFrames] 
[Registering JNI native method java.lang.Thread.interrupt0] 
[Registering JNI native method java.lang.Thread.isInterrupted] 
[Registering JNI native method java.lang.Thread.holdsLock] 
[Registering JNI native method java.lang.Thread.getThreads] 
[Registering JNI native method java.lang.Thread.dumpThreads] 
[Registering JNI native method java.lang.Thread.setNativeName] 
[Dynamic-linking native method java.security.AccessController.getStackAccessControlContext ... JNI] 
[Dynamic-linking native method java.security.AccessController.getInheritedAccessControlContext ... JNI] 
[Dynamic-linking native method java.lang.Class.registerNatives ... JNI] 
[Registering JNI native method java.lang.Class.getName0] 
[Registering JNI native method java.lang.Class.getSuperclass] 
[Registering JNI native method java.lang.Class.getInterfaces0] 
[Registering JNI native method java.lang.Class.getClassLoader0] 
[Registering JNI native method java.lang.Class.isInterface] 
[Registering JNI native method java.lang.Class.getSigners] 
[Registering JNI native method java.lang.Class.setSigners] 
[Registering JNI native method java.lang.Class.isArray] 
[Registering JNI native method java.lang.Class.isPrimitive] 
[Registering JNI native method java.lang.Class.getComponentType] 
[Registering JNI native method java.lang.Class.getModifiers] 
[Registering JNI native method java.lang.Class.getDeclaredFields0] 
[Registering JNI native method java.lang.Class.getDeclaredMethods0] 
[Registering JNI native method java.lang.Class.getDeclaredConstructors0] 
[Registering JNI native method java.lang.Class.getProtectionDomain0] 
[Registering JNI native method java.lang.Class.getDeclaredClasses0] 
[Registering JNI native method java.lang.Class.getDeclaringClass0] 
[Registering JNI native method java.lang.Class.getGenericSignature0] 
[Registering JNI native method java.lang.Class.getRawAnnotations] 
[Registering JNI native method java.lang.Class.getConstantPool] 
[Registering JNI native method java.lang.Class.desiredAssertionStatus0] 
[Registering JNI native method java.lang.Class.getEnclosingMethod0] 
[Registering JNI native method java.lang.Class.getRawTypeAnnotations] 
[Dynamic-linking native method java.lang.ClassLoader.registerNatives ... JNI] 
[Registering JNI native method java.lang.ClassLoader.retrieveDirectives] 
[Dynamic-linking native method java.security.AccessController.doPrivileged ... JNI] 
[Dynamic-linking native method java.lang.Class.getPrimitiveClass ... JNI] 
[Dynamic-linking native method java.lang.Float.floatToRawIntBits ... JNI] 
[Dynamic-linking native method java.lang.Double.doubleToRawLongBits ... JNI] 
[Dynamic-linking native method java.lang.Double.longBitsToDouble ... JNI] 
[Dynamic-linking native method java.lang.System.initProperties ... JNI] 
[Dynamic-linking native method sun.misc.VM.initialize ... JNI] 
[Dynamic-linking native method sun.misc.Unsafe.registerNatives ... JNI] 
[Registering JNI native method sun.misc.Unsafe.getObject] 
[Registering JNI native method sun.misc.Unsafe.putObject] 
[Registering JNI native method sun.misc.Unsafe.getObjectVolatile] 
[Registering JNI native method sun.misc.Unsafe.putObjectVolatile] 
[Registering JNI native method sun.misc.Unsafe.getBoolean] 
[Registering JNI native method sun.misc.Unsafe.putBoolean] 
[Registering JNI native method sun.misc.Unsafe.getBooleanVolatile] 
[Registering JNI native method sun.misc.Unsafe.putBooleanVolatile] 
[Registering JNI native method sun.misc.Unsafe.getByte] 
[Registering JNI native method sun.misc.Unsafe.putByte] 
[Registering JNI native method sun.misc.Unsafe.getByteVolatile] 
[Registering JNI native method sun.misc.Unsafe.putByteVolatile] 
[Registering JNI native method sun.misc.Unsafe.getShort] 
[Registering JNI native method sun.misc.Unsafe.putShort] 
[Registering JNI native method sun.misc.Unsafe.getShortVolatile] 
[Registering JNI native method sun.misc.Unsafe.putShortVolatile] 
[Registering JNI native method sun.misc.Unsafe.getChar] 
[Registering JNI native method sun.misc.Unsafe.putChar] 
[Registering JNI native method sun.misc.Unsafe.getCharVolatile] 
[Registering JNI native method sun.misc.Unsafe.putCharVolatile] 
[Registering JNI native method sun.misc.Unsafe.getInt] 
[Registering JNI native method sun.misc.Unsafe.putInt] 
[Registering JNI native method sun.misc.Unsafe.getIntVolatile] 
[Registering JNI native method sun.misc.Unsafe.putIntVolatile] 
[Registering JNI native method sun.misc.Unsafe.getLong] 
[Registering JNI native method sun.misc.Unsafe.putLong] 
[Registering JNI native method sun.misc.Unsafe.getLongVolatile] 
[Registering JNI native method sun.misc.Unsafe.putLongVolatile] 
[Registering JNI native method sun.misc.Unsafe.getFloat] 
[Registering JNI native method sun.misc.Unsafe.putFloat] 
[Registering JNI native method sun.misc.Unsafe.getFloatVolatile] 
[Registering JNI native method sun.misc.Unsafe.putFloatVolatile] 
[Registering JNI native method sun.misc.Unsafe.getDouble] 
[Registering JNI native method sun.misc.Unsafe.putDouble] 
[Registering JNI native method sun.misc.Unsafe.getDoubleVolatile] 
[Registering JNI native method sun.misc.Unsafe.putDoubleVolatile] 
[Registering JNI native method sun.misc.Unsafe.getByte] 
[Registering JNI native method sun.misc.Unsafe.putByte] 
[Registering JNI native method sun.misc.Unsafe.getShort] 
[Registering JNI native method sun.misc.Unsafe.putShort] 
[Registering JNI native method sun.misc.Unsafe.getChar] 
[Registering JNI native method sun.misc.Unsafe.putChar] 
[Registering JNI native method sun.misc.Unsafe.getInt] 
[Registering JNI native method sun.misc.Unsafe.putInt] 
[Registering JNI native method sun.misc.Unsafe.getLong] 
[Registering JNI native method sun.misc.Unsafe.putLong] 
[Registering JNI native method sun.misc.Unsafe.getFloat] 
[Registering JNI native method sun.misc.Unsafe.putFloat] 
[Registering JNI native method sun.misc.Unsafe.getDouble] 
[Registering JNI native method sun.misc.Unsafe.putDouble] 
[Registering JNI native method sun.misc.Unsafe.getAddress] 
[Registering JNI native method sun.misc.Unsafe.putAddress] 
[Registering JNI native method sun.misc.Unsafe.allocateMemory] 
[Registering JNI native method sun.misc.Unsafe.reallocateMemory] 
[Registering JNI native method sun.misc.Unsafe.freeMemory] 
[Registering JNI native method sun.misc.Unsafe.objectFieldOffset] 
[Registering JNI native method sun.misc.Unsafe.staticFieldOffset] 
[Registering JNI native method sun.misc.Unsafe.staticFieldBase] 
[Registering JNI native method sun.misc.Unsafe.ensureClassInitialized] 
[Registering JNI native method sun.misc.Unsafe.arrayBaseOffset] 
[Registering JNI native method sun.misc.Unsafe.arrayIndexScale] 
[Registering JNI native method sun.misc.Unsafe.addressSize] 
[Registering JNI native method sun.misc.Unsafe.pageSize] 
[Dynamic-linking native method java.lang.Throwable.fillInStackTrace ... JNI] 
[Registering JNI native method sun.misc.Unsafe.getObject] 
[Registering JNI native method sun.misc.Unsafe.putObject] 
[Registering JNI native method sun.misc.Unsafe.getObjectVolatile] 
[Registering JNI native method sun.misc.Unsafe.putObjectVolatile] 
[Registering JNI native method sun.misc.Unsafe.getBoolean] 
[Registering JNI native method sun.misc.Unsafe.putBoolean] 
[Registering JNI native method sun.misc.Unsafe.getBooleanVolatile] 
[Registering JNI native method sun.misc.Unsafe.putBooleanVolatile] 
[Registering JNI native method sun.misc.Unsafe.getByte] 
[Registering JNI native method sun.misc.Unsafe.putByte] 
[Registering JNI native method sun.misc.Unsafe.getByteVolatile] 
[Registering JNI native method sun.misc.Unsafe.putByteVolatile] 
[Registering JNI native method sun.misc.Unsafe.getShort] 
[Registering JNI native method sun.misc.Unsafe.putShort] 
[Registering JNI native method sun.misc.Unsafe.getShortVolatile] 
[Registering JNI native method sun.misc.Unsafe.putShortVolatile] 
[Registering JNI native method sun.misc.Unsafe.getChar] 
[Registering JNI native method sun.misc.Unsafe.putChar] 
[Registering JNI native method sun.misc.Unsafe.getCharVolatile] 
[Registering JNI native method sun.misc.Unsafe.putCharVolatile] 
[Registering JNI native method sun.misc.Unsafe.getInt] 
[Registering JNI native method sun.misc.Unsafe.putInt] 
[Registering JNI native method sun.misc.Unsafe.getIntVolatile] 
[Registering JNI native method sun.misc.Unsafe.putIntVolatile] 
[Registering JNI native method sun.misc.Unsafe.getLong] 
[Registering JNI native method sun.misc.Unsafe.putLong] 
[Registering JNI native method sun.misc.Unsafe.getLongVolatile] 
[Registering JNI native method sun.misc.Unsafe.putLongVolatile] 
[Registering JNI native method sun.misc.Unsafe.getFloat] 
[Registering JNI native method sun.misc.Unsafe.putFloat] 
[Registering JNI native method sun.misc.Unsafe.getFloatVolatile] 
[Registering JNI native method sun.misc.Unsafe.putFloatVolatile] 
[Registering JNI native method sun.misc.Unsafe.getDouble] 
[Registering JNI native method sun.misc.Unsafe.putDouble] 
[Registering JNI native method sun.misc.Unsafe.getDoubleVolatile] 
[Registering JNI native method sun.misc.Unsafe.putDoubleVolatile] 
[Registering JNI native method sun.misc.Unsafe.getByte] 
[Registering JNI native method sun.misc.Unsafe.putByte] 
[Registering JNI native method sun.misc.Unsafe.getShort] 
[Registering JNI native method sun.misc.Unsafe.putShort] 
[Registering JNI native method sun.misc.Unsafe.getChar] 
[Registering JNI native method sun.misc.Unsafe.putChar] 
[Registering JNI native method sun.misc.Unsafe.getInt] 
[Registering JNI native method sun.misc.Unsafe.putInt] 
[Registering JNI native method sun.misc.Unsafe.getLong] 
[Registering JNI native method sun.misc.Unsafe.putLong] 
[Registering JNI native method sun.misc.Unsafe.getFloat] 
[Registering JNI native method sun.misc.Unsafe.putFloat] 
[Registering JNI native method sun.misc.Unsafe.getDouble] 
[Registering JNI native method sun.misc.Unsafe.putDouble] 
[Registering JNI native method sun.misc.Unsafe.getAddress] 
[Registering JNI native method sun.misc.Unsafe.putAddress] 
[Registering JNI native method sun.misc.Unsafe.allocateMemory] 
[Registering JNI native method sun.misc.Unsafe.reallocateMemory] 
[Registering JNI native method sun.misc.Unsafe.freeMemory] 
[Registering JNI native method sun.misc.Unsafe.objectFieldOffset] 
[Registering JNI native method sun.misc.Unsafe.staticFieldOffset] 
[Registering JNI native method sun.misc.Unsafe.staticFieldBase] 
[Registering JNI native method sun.misc.Unsafe.ensureClassInitialized] 
[Registering JNI native method sun.misc.Unsafe.arrayBaseOffset] 
[Registering JNI native method sun.misc.Unsafe.arrayIndexScale] 
[Registering JNI native method sun.misc.Unsafe.addressSize] 
[Registering JNI native method sun.misc.Unsafe.pageSize] 
[Registering JNI native method sun.misc.Unsafe.defineClass] 
[Registering JNI native method sun.misc.Unsafe.allocateInstance] 
[Registering JNI native method sun.misc.Unsafe.monitorEnter] 
[Registering JNI native method sun.misc.Unsafe.monitorExit] 
[Registering JNI native method sun.misc.Unsafe.tryMonitorEnter] 
[Registering JNI native method sun.misc.Unsafe.throwException] 
[Registering JNI native method sun.misc.Unsafe.compareAndSwapObject] 
[Registering JNI native method sun.misc.Unsafe.compareAndSwapInt] 
[Registering JNI native method sun.misc.Unsafe.compareAndSwapLong] 
[Registering JNI native method sun.misc.Unsafe.putOrderedObject] 
[Registering JNI native method sun.misc.Unsafe.putOrderedInt] 
[Registering JNI native method sun.misc.Unsafe.putOrderedLong] 
[Registering JNI native method sun.misc.Unsafe.park] 
[Registering JNI native method sun.misc.Unsafe.unpark] 
[Registering JNI native method sun.misc.Unsafe.getLoadAverage] 
[Registering JNI native method sun.misc.Unsafe.copyMemory] 
[Registering JNI native method sun.misc.Unsafe.setMemory] 
[Registering JNI native method sun.misc.Unsafe.defineAnonymousClass] 
[Registering JNI native method sun.misc.Unsafe.shouldBeInitialized] 
[Registering JNI native method sun.misc.Unsafe.loadFence] 
[Registering JNI native method sun.misc.Unsafe.storeFence] 
[Registering JNI native method sun.misc.Unsafe.fullFence] 
[Dynamic-linking native method sun.reflect.Reflection.getCallerClass ... JNI] 
[Dynamic-linking native method java.lang.String.intern ... JNI] 
[Dynamic-linking native method java.lang.Object.getClass ... JNI] 
[Dynamic-linking native method java.lang.Class.forName0 ... JNI] 
[Dynamic-linking native method sun.reflect.Reflection.getClassAccessFlags ... JNI] 
[Dynamic-linking native method sun.reflect.NativeConstructorAccessorImpl.newInstance0 ... JNI] 
[Dynamic-linking native method java.lang.Runtime.maxMemory ... JNI] 
[Dynamic-linking native method java.io.FileInputStream.initIDs ... JNI] 
[Dynamic-linking native method java.io.FileDescriptor.initIDs ... JNI] 
[Dynamic-linking native method java.io.FileOutputStream.initIDs ... JNI] 
[Dynamic-linking native method java.security.AccessController.doPrivileged ... JNI] 
[Dynamic-linking native method java.lang.System.setIn0 ... JNI] 
[Dynamic-linking native method java.lang.System.setOut0 ... JNI] 
[Dynamic-linking native method java.lang.System.setErr0 ... JNI] 
[Dynamic-linking native method java.io.UnixFileSystem.initIDs ... JNI] 
[Dynamic-linking native method java.lang.System.mapLibraryName ... JNI] 
[Dynamic-linking native method java.lang.ClassLoader$NativeLibrary.findBuiltinLib ... JNI] 
[Dynamic-linking native method java.io.UnixFileSystem.getBooleanAttributes0 ... JNI] 
[Dynamic-linking native method java.io.UnixFileSystem.canonicalize0 ... JNI] 
[Dynamic-linking native method java.lang.ClassLoader$NativeLibrary.load ... JNI] 
[Dynamic-linking native method sun.misc.Signal.findSignal ... JNI] 
[Dynamic-linking native method sun.misc.Signal.handle0 ... JNI] 
[Dynamic-linking native method java.lang.Compiler.registerNatives ... JNI] 
[Registering JNI native method java.lang.Compiler.compileClass] 
[Registering JNI native method java.lang.Compiler.compileClasses] 
[Registering JNI native method java.lang.Compiler.command] 
[Registering JNI native method java.lang.Compiler.enable] 
[Registering JNI native method java.lang.Compiler.disable] 
[Dynamic-linking native method java.lang.Class.isAssignableFrom ... JNI] 
[Dynamic-linking native method java.io.FileInputStream.open ... JNI] 
[Dynamic-linking native method java.io.FileInputStream.readBytes ... JNI] 
[Dynamic-linking native method java.io.FileInputStream.available ... JNI] 
[Dynamic-linking native method java.lang.reflect.Array.newArray ... JNI] 
[Dynamic-linking native method java.io.FileInputStream.close0 ... JNI] 
[Dynamic-linking native method java.io.UnixFileSystem.list ... JNI] 
[Dynamic-linking native method java.lang.Runtime.availableProcessors ... JNI] 
[Dynamic-linking native method java.lang.invoke.MethodHandleNatives.registerNatives ... JNI] 
[Registering JNI native method java.lang.invoke.MethodHandleNatives.init] 
[Registering JNI native method java.lang.invoke.MethodHandleNatives.expand] 
[Registering JNI native method java.lang.invoke.MethodHandleNatives.resolve] 
[Registering JNI native method java.lang.invoke.MethodHandleNatives.getConstant] 
[Registering JNI native method java.lang.invoke.MethodHandleNatives.getNamedCon] 
[Registering JNI native method java.lang.invoke.MethodHandleNatives.getMembers] 
[Registering JNI native method java.lang.invoke.MethodHandleNatives.objectFieldOffset] 
[Registering JNI native method java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal] 
[Registering JNI native method java.lang.invoke.MethodHandleNatives.setCallSiteTargetVolatile] 
[Registering JNI native method java.lang.invoke.MethodHandleNatives.staticFieldOffset] 
[Registering JNI native method java.lang.invoke.MethodHandleNatives.staticFieldBase] 
[Registering JNI native method java.lang.invoke.MethodHandleNatives.getMemberVMInfo] 
[Registering JNI native method java.lang.invoke.MethodHandle.invoke] 
[Registering JNI native method java.lang.invoke.MethodHandle.invokeExact] 
[Dynamic-linking native method java.lang.ClassLoader$NativeLibrary.find ... JNI] 
[Dynamic-linking native method java.util.zip.ZipFile.initIDs ... JNI] 
[Dynamic-linking native method java.io.UnixFileSystem.getLastModifiedTime ... JNI] 
[Dynamic-linking native method java.util.zip.ZipFile.open ... JNI] 
[Dynamic-linking native method sun.misc.Perf.registerNatives ... JNI] 
[Registering JNI native method sun.misc.Perf.attach] 
[Registering JNI native method sun.misc.Perf.detach] 
[Registering JNI native method sun.misc.Perf.createLong] 
[Registering JNI native method sun.misc.Perf.createByteArray] 
[Registering JNI native method sun.misc.Perf.highResCounter] 
[Registering JNI native method sun.misc.Perf.highResFrequency] 
[Dynamic-linking native method java.util.zip.ZipFile.getTotal ... JNI] 
[Dynamic-linking native method java.util.zip.ZipFile.startsWithLOC ... JNI] 
[Dynamic-linking native method java.util.zip.ZipFile.getEntry ... JNI] 
[Dynamic-linking native method java.util.zip.ZipFile.getEntryFlag ... JNI] 
[Dynamic-linking native method java.util.zip.ZipFile.getEntryTime ... JNI] 
[Dynamic-linking native method java.util.TimeZone.getSystemTimeZoneID ... JNI] 
[Dynamic-linking native method java.util.zip.ZipFile.getEntryCrc ... JNI] 
[Dynamic-linking native method java.util.zip.ZipFile.getEntrySize ... JNI] 
[Dynamic-linking native method java.util.zip.ZipFile.getEntryCSize ... JNI] 
[Dynamic-linking native method java.util.zip.ZipFile.getEntryMethod ... JNI] 
[Dynamic-linking native method java.util.zip.ZipFile.getEntryBytes ... JNI] 
[Dynamic-linking native method java.util.zip.ZipFile.freeEntry ... JNI] 
[Dynamic-linking native method java.util.zip.Inflater.initIDs ... JNI] 
[Dynamic-linking native method java.util.zip.Inflater.init ... JNI] 
[Dynamic-linking native method java.util.zip.Inflater.inflateBytes ... JNI] 
[Dynamic-linking native method java.util.zip.ZipFile.read ... JNI] 
[Dynamic-linking native method java.util.zip.Inflater.reset ... JNI] 
[Dynamic-linking native method java.util.zip.Inflater.end ... JNI] 
[Dynamic-linking native method java.util.zip.ZipFile.close ... JNI] 
[Dynamic-linking native method java.lang.ClassLoader.findLoadedClass0 ... JNI] 
[Dynamic-linking native method java.lang.ClassLoader.findBootstrapClass ... JNI] 
[Dynamic-linking native method java.security.AccessController.doPrivileged ... JNI] 
[Dynamic-linking native method java.util.jar.JarFile.getMetaInfEntryNames ... JNI] 
[Dynamic-linking native method java.lang.Package.getSystemPackage0 ... JNI] 
[Dynamic-linking native method java.lang.ClassLoader.defineClass1 ... JNI] 
[Dynamic-linking native method sun.reflect.NativeMethodAccessorImpl.invoke0 ... JNI] 
[Dynamic-linking native method java.security.AccessController.doPrivileged ... JNI] 
[Dynamic-linking native method java.io.FileOutputStream.writeBytes ... JNI] 
*** Loading hardcoded library 
[Dynamic-linking native method java.lang.System.identityHashCode ... JNI] 
[Dynamic-linking native method java.lang.Throwable.getStackTraceDepth ... JNI] 
[Dynamic-linking native method java.lang.Throwable.getStackTraceElement ... JNI] 
[Dynamic-linking native method java.lang.Class.isInstance ... JNI] 
[Dynamic-linking native method java.util.concurrent.atomic.AtomicLong.VMSupportsCS8 ... JNI] 
[Dynamic-linking native method java.lang.reflect.Proxy.defineClass0 ... JNI] 
Working Directory = /home/pi/conor/JavaGo 

而且隨着關於確切的錯誤,請參閱以下內容:

消息體飽滿,請參閱this paste的堆棧跟蹤,但在堆棧跟蹤主要錯誤如下:

java.lang.UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError: no jffi-1.2 in java.library.path 

我想重申,我已經設置相應的使用,-Djava.library.path-DLD_LIBRARY_PATH的路徑。

+0

,我有類似的困難,事實證明,即使我*思想*我已經正確設置了庫路徑,它沒有被設置。 你是100%,絕對確定它的設置是否正確? – gsaslis

+0

不幸的是我確定它是正確的:( – conor

+0

你得到了什麼確切的錯誤?你嘗試添加'-verbose:jni'選項到'java'程序啓動器來調試? – pcarter

回答

0

由於代碼我做出了答案。您可以用它來看看你的java.library.path

public class JavaLibPath { 

    public static void main(String[] args) { 
     String libPathProperty = System.getProperty("java.library.path"); 
     System.out.println(libPathProperty); 
    } 
} 

然後檢查jffi-1.2可以在這個路徑中找到,或者如果它是您的計算機上反正

https://examples.javacodegeeks.com/java-basics/java-library-path-what-is-it-and-how-to-use/說:

當Java應用程序使用方法加載本機庫時,會掃描指定庫的java.library.path。如果JVM無法檢測到所請求的庫,則會拋出一個UnsatisfiedLinkError。最後,本地庫的使用使Java程序更依賴於平臺,因爲它需要特定的本地庫的存在。

UPDATE:看來jffi未在RPI默認安裝,看到這個鏈接http://peterwawood.blogspot.de/2014/07/compling-jffi-on-raspberry-pi.html,並在過去的項目這個How to build JRuby 1.7.13 on Raspberry Pi with rbenv/ruby-build?

相關問題