An issue was encountered while extracting the trie tree portion of the Ethereum Java version:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load library. Reasons: [no leveldbjni64-1.8 in java.library.path, no leveldbjni-1.8 in java.library.path, no leveldbjni in java.library.path]
at org.fusesource.hawtjni.runtime.Library.doLoad(Library.java:182)
at org.fusesource.hawtjni.runtime.Library.load(Library.java:140)
at org.fusesource.leveldbjni.JniDBFactory.<clinit>(JniDBFactory.java:48)
at Test.main(Test.java:13)
Refer to Fusessource's Leveldb's readme to solve this problem
Only need to import the Leveldbjni-win64-1.8.jar into the project (should be run under Win64)
To set up a project maven dependency:
<dependency>
<groupId>org.fusesource.leveldbjni</groupId>
<artifactId>leveldbjni-win64</artifactId>
<version>99-master-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.fusesource.leveldbjni</groupId>
<artifactId>leveldbjni</artifactId>
<version>99-master-SNAPSHOT</version>
</dependency>
I used the Gradle management project to add in the project Build.gradle dependencies
compile "org.fusesource.leveldbjni:leveldbjni:1.8"
compile "org.fusesource.leveldbjni:leveldbjni-win64:1.8"
Two lines, then update the item to
Reference: Https://github.com/fusesource/leveldbjni
PS. What is Java.library.path
Java typically uses two Path:classpath and Java.library.path
Classpath is the location that points to the jar package
Java.library.path the location of the non-Java class package (DLL,SO), Java.library.path can be viewed through System.getpropertu ("Java.library.path").
public static void main(String[] args){
System.out.println("java.library.path: ");
System.out.println(System.getProperty("java.library.path"));
}
The output is:
java.library.path:
D:\Java\jdk1.8.0_91\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:/Jav。。。。
No leveldbjni64-1.8 in Java.library.path