Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>The idea is to make the static field "sys_paths" null</strong> so that it would construct the paths from the changed value. See the post here (Post#223 by AjaySingh516) <a href="http://forums.sun.com/thread.jspa?messageID=3744346#3744346" rel="nofollow noreferrer">http://forums.sun.com/thread.jspa?messageID=3744346#3744346</a></p> <pre><code>Class clazz = ClassLoader.class; Field field = clazz.getDeclaredField("sys_paths"); boolean accessible = field.isAccessible(); if (!accessible) field.setAccessible(true); Object original = field.get(clazz); // Reset it to null so that whenever "System.loadLibrary" is called, it // will be reconstructed with the changed value. field.set(clazz, null); try { // Change the value and load the library. System.setProperty("java.library.path", "./libs/"); System.loadLibrary("mylibapr"); } finally { // Revert back the changes. field.set(clazz, original); field.setAccessible(accessible); } </code></pre> <p>.</p> <p><strong>gcj System Properties</strong> (See: Standard properties supported by libgcj)</p> <p><a href="http://gcc.gnu.org/onlinedocs/gcj/System-properties.html" rel="nofollow noreferrer">http://gcc.gnu.org/onlinedocs/gcj/System-properties.html</a> </p> <p>.</p> <p><strong>Solution#2</strong> : Set System environment variable at compile time</p> <p><a href="http://linux.die.net/man/1/gcj" rel="nofollow noreferrer">http://linux.die.net/man/1/gcj</a></p> <p>For this you have to use parameter <code>-Djava.library.path=./libs/</code> with <code>gcj</code> </p> <p><strong>From gcj manual (above link):</strong></p> <p><strong>--main= CLASSNAME</strong></p> <p>This option is used when linking to specify the name of the class whose "main" method should be invoked when the resulting executable is run. </p> <p><strong>-Dname[=value]</strong></p> <p>This option can only be used with "--main". It defines a system property named name with value value. If value is not specified then it defaults to the empty string. <strong>These system properties are initialized at the program's startup and can be retrieved at runtime</strong> using the "java.lang.System.getProperty" method. </p> <p>I have never worked with gcj but as per docs these system properties can be retrieved at runtime, hence it will be portable to other systems as well.</p> <p>Also see: <a href="http://gcc.gnu.org/wiki/Statically_linking_libgcj?action=show&amp;redirect=Statically+linking+libgcj" rel="nofollow noreferrer">http://gcc.gnu.org/wiki/Statically_linking_libgcj?action=show&amp;redirect=Statically+linking+libgcj</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload