mattrglobal / ffi-bbs-signatures

An FFI wrapper around the implementation of BBS+ signatures in Ursa
Apache License 2.0
23 stars 23 forks source link

Error: no bbs in java.library.path #24

Closed youngjoon-lee closed 3 years ago

youngjoon-lee commented 3 years ago

Hi,

I was trying to write a Java application with a Jar file that I generated by following the guide: https://github.com/mattrglobal/ffi-bbs-signatures/blob/master/wrappers/java/README.md. I successfully generated the Jar file: bbs.signatures-1.5-SNAPSHOT.jar, and I imported it to my Java application. (To make it simple, I created a simple Java application without using maven or gradle).

I wrote the Java application like below:

package com.company;

import bbs.signatures.Bbs;
import bbs.signatures.KeyPair;

public class Main {
    public static void main(String[] args) throws Exception {
        KeyPair keyPair = Bbs.generateBls12381G2Key(null);
        System.out.println(keyPair);
    }
}
├── lib
│   └── bbs.signatures-1.5-SNAPSHOT.jar
├── src
│   └── com
│       └── company
│           └── Main.java

But, when I ran the application, I got the following error regards to JNI:

/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java -javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=49767:/Applications/IntelliJ IDEA.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Users/magnus/repos/untitled4/out/production/untitled4:/Users/magnus/repos/untitled4/lib/bbs.signatures-1.5-SNAPSHOT.jar com.company.Main
Exception in thread "main" java.lang.UnsatisfiedLinkError: no bbs in java.library.path: [/Users/magnus/Library/Java/Extensions, /Library/Java/Extensions, /Network/Library/Java/Extensions, /System/Library/Java/Extensions, /usr/lib/java, .]
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2670)
    at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
    at java.base/java.lang.System.loadLibrary(System.java:1873)
    at com.company.Main.<clinit>(Main.java:9)

Could you provide me a short guide how to use this Java wrapper?