Hebing
Hebing

Reputation: 491

how to find shared library path in java without using LD_LIBRARY_PATH

I want to load so file "libhello.so" with java, for some reasons, i can't change LD_LIBRARY_PATH in redhat, the .so file "libhello.so" is in /home/arthur/lib, how can i load this so file? below is the sample code:

class HelloWorld {

    public static void main(String[] args) {
        System.loadLibrary("hello");
    }
}

Upvotes: 0

Views: 405

Answers (1)

xdazz
xdazz

Reputation: 160923

Try this way:

System.load("/home/arthur/lib/libhello.so");

Upvotes: 1

Related Questions