Github user vanzin commented on the pull request:

    https://github.com/apache/spark/pull/1031#issuecomment-57518693
  
    I wrote a small test for this; it uses three implementations of the same 
native library that print different things, and a small java class to call it. 
This is the output:
    
        LD_LIBRARY_PATH=lib1
        ld1
        java.library.path=lib2
        ld2
        LD_LIBRARY_PATH=lib1 and java.library.path=lib2
        ld2
        LD_LIBRARY_PATH=lib1 and invalid java.library.path
        Exception in thread "main" java.lang.UnsatisfiedLinkError: no javald in 
java.library.path
                at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
                at java.lang.Runtime.loadLibrary0(Runtime.java:870)
                at java.lang.System.loadLibrary(System.java:1119)
                at ld.main(ld.java:4)
        lib3 in /usr/lib and LD_LIBRARY_PATH=lib1 and java.library.path=lib2
        ld2
        lib3 in /usr/lib and LD_LIBRARY_PATH=lib1
        ld1
        lib3 in /usr/lib and java.library.path=lib2
        ld2
        lib3 in /usr/lib and invalid LD_LIBRARY_PATH
        ld3
        lib3 in /usr/lib and invalid java.library.path
        Exception in thread "main" java.lang.UnsatisfiedLinkError: no javald in 
java.library.path
                at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
                at java.lang.Runtime.loadLibrary0(Runtime.java:870)
                at java.lang.System.loadLibrary(System.java:1119)
                at ld.main(ld.java:4)
    
    So Tom's observation that setting `java.library.path` prevents the JVM from 
looking for libraries in the system path (or `LD_LIBRARY_PATH`) seems correct. 
So, basically, relying on `java.library.path` means that anyone trying to use 
JNI libs in system directories will have a hard time doing so.
    
    So, perhaps, even if it's more code, using `LD_LIBRARY_PATH` would result 
in more intuitive behavior for users.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to