-
Notifications
You must be signed in to change notification settings - Fork 6
Description
The current implementation relies on being able to find the secp256k1 native library via the SECP_EXAMPLES_JAVA_OPTS="-Djava.library.path=$HOME/.nix-profile/lib mechanism.
From Issue #79
When distributing a client application, one cannot rely on the presence of any external libraries (like secp256k1). Generally, the approach is to package these libraries in the application jar. When the library is used, it is first extracted to a temporary location on the user's drive and loaded directly from there using
System.load(filepath). However, the approach used by jextract is different - it expects to be able to find the library onjava.library.pathwhich must be specified on application startup, since it is only read once. The problem is in the static initializer:I was able to get it working by commenting this block out and performing the library loading [manually]secp256k1-jdk/secp-ffm/src/main/java/org/bitcoinj/secp/ffm/jextract/secp256k1_h.java
Lines 71 to 73 in 453da0b
static { System.loadLibrary("secp256k1"); }