Add functions to be able to set the LD_LIBRARY_PATH to C from JAVA
authorWilliam Bourque <william.bourque@polymtl.ca>
Fri, 12 Mar 2010 22:08:41 +0000 (22:08 +0000)
committerWilliam Bourque <william.bourque@polymtl.ca>
Fri, 12 Mar 2010 22:08:41 +0000 (22:08 +0000)
org.eclipse.linuxtools.lttng.jni/src/org/eclipse/linuxtools/lttng/jni/factory/JniTraceVersion.java

index c6a673dbefbba05faeebdd0c6bd6e9720c96532e..a8125cc9f8f98906378e90b4d8e555879d5e619b 100644 (file)
@@ -5,6 +5,7 @@ import org.eclipse.linuxtools.lttng.jni.exception.JniTraceVersionException;
 public class JniTraceVersion {
        
        protected native void ltt_getTraceVersion(String tracepath);
+       protected native void ltt_setLibraryPath(String ldLibraryPath);
        
        private int majorNumber = 0;
        private int minorNumber = 0;
@@ -41,6 +42,11 @@ public class JniTraceVersion {
                        // If LD_LIBRARY_PATH is not set correctly this will raise a java.lang.UnsatisfiedLinkError
                        System.loadLibrary("lttvtraceread_loader");
                        
+                       // The user's LD_LIBRARY_PATH environnement variable doesn't seem to be get passed to the C
+                       // We will force C to load it here
+                       String ldLibraryPath = "LD_LIBRARY_PATH:" + System.getenv("LD_LIBRARY_PATH");
+                       ltt_setLibraryPath(ldLibraryPath);
+                       
                        // Assuming the C library loaded correctly, call the JNI here.
                        ltt_getTraceVersion(tracepath);
                }
This page took 0.025219 seconds and 5 git commands to generate.