1

I'm trying to execute the openvenues-jpostal package but I got this errors (after a lot of work to build and compile everything from libpostal!!). What I've done is:

Install libpostal

build jpostal (./gradlew assemble) -> this give me the jpostal.jar

copy jpostal.jar into lib in my project -> this let me import com.mapzen.jpostal.AddressExpander into a class of my project

Also got .so files from src/main/jniLibs. I copied jniLibs files into my Project root directory as in image. Project Structure

when I try to execute one of the examples (Parser, and Expander) this is the result:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jpostal_expander in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at com.mapzen.jpostal.AddressExpander.<clinit>(AddressExpander.java:7)

AddressExpander.java class is given below AddressExpander.java

My java class is give below

import java.io.IOException;
import com.mapzen.jpostal.AddressParser;
import com.mapzen.jpostal.ParsedComponent;

public class MyAddressParser {
    public static void main(String[] args) throws IOException {
        System.setProperty("java.library.path", "/jniLibs");

        AddressParser p = AddressParser.getInstance();
        ParsedComponent[] components = p.parseAddress(
                "The Book Club 100-106 Leonard St, Shoreditch, London, Greater London, EC2A 4RH, United Kingdom");
        for (ParsedComponent c : components) {
            System.out.printf("%s: %s\n", c.getLabel(), c.getValue());
        }
    }
}

Any help. I'm working on Windows, but I need to deploy in Linux

Juhan
  • 1,283
  • 2
  • 11
  • 30
  • Does this answer your question? [How to bundle a native library and a JNI library inside a JAR?](https://stackoverflow.com/questions/2937406/how-to-bundle-a-native-library-and-a-jni-library-inside-a-jar) – Botje Aug 24 '20 at 07:04
  • If you're running on Windows, then you need a .dll, not a .so, .a or .la. – Mark Rotteveel Aug 24 '20 at 18:01

0 Answers0