fusesource / leveldbjni

A Java Native Interface to LevelDB
BSD 3-Clause "New" or "Revised" License
535 stars 145 forks source link

Selecting Data from DB with Java on Raspberry-Pi ERROR #97

Open painpunisher opened 6 years ago

painpunisher commented 6 years ago

Hello dev's,

im getting this error on my raspberry pi with raspbian on it with a small java app code is below. But Works fine on windows 10 no problems there.

Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load library. Reasons: [no leveldbjni in java.library.path, /tmp/libleveldbjni-32-3210388738393244372.so: /tmp/libleveldbjni-32-3210388738393244372.so: cannot open shared object file: No such file or directory (Possible cause: can't load IA 32-bit .so on a ARM-bit platform)] 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 leveldbtest.Main.main(Main.java:26) This is the code:

` package leveldbtest;

import java.io.File; import java.io.IOException;

import org.iq80.leveldb.DB; import static org.fusesource.leveldbjni.JniDBFactory.asString; import static org.fusesource.leveldbjni.JniDBFactory.bytes; import static org.iq80.leveldb.impl.Iq80DBFactory.factory; import org.iq80.leveldb.Options;

public class Main {

public static void main(String[] args) {
    // TODO Auto-generated method stub
    DB levelDBStore = null;
    Options options = new Options();
    try {
        levelDBStore = factory.open(new File("levelDBStore"),options);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    levelDBStore.put(bytes("key"),bytes("value"));

    System.out.println(new String(levelDBStore.get(bytes("key"))));
}

} ` anyone knows the problem?

Thanks very much.

krez01 commented 5 years ago

The library you are using is compiled on Intel 32 Architecture. It runs on your Windows PC because it's having Intel Architecture, mostly it will be 64 bit, but you still can run 32-bit programs on it. Now you are using that library for Rasberry Pi which is made of ARM architecture. What you can do see if there is arm version available of the library or if you have the source of the library you can compile yourself for arm architecture.