Question

Setting java.library.path at runtime doesn't do anything:

public class Test{
public static void main(String []args){
    System.out.println(System.getProperty("java.library.path"));
}
}

I run Test (having build it previously) like this:

user:~$ sudo java -d64 Test -Djava.library.path=./Music/

The output is:

/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib

What am I doing wrong? Did this happen to anyone else?

Also, I tried to set it in the command line, with the same result:

user:~$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./Music/
user:~$ echo $LD_LIBRARY_PATH
> ./Music
user:~$ java -XshowSettings:properties
Property settings:
....
java.library.path = ./Music
    /usr/java/packages/lib/amd64
    /usr/lib64
    /lib64
    /lib
    /usr/lib
Was it helpful?

Solution

sudo java -Djava.library.path=./Music/ -d64 Test 

Et voila :-) The "-D" must go before your programme's name.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top