Login  Register

Re: Running natives from JARs

Posted by Wade Walker on Apr 10, 2011; 5:40pm
URL: https://forum.jogamp.org/Running-natives-from-JARs-tp2800394p2803079.html

SWT does this sort of "classpath libloading". The SWT startup code looks at the value of java.library.path, and extracts the SWT .dll/.so/.jnilib files to one of those paths that the JVM is already looking at. Then subsequent System.loadLibrary() calls will work properly, and the user doesn't have to see any .dll/.so/.jnilib at all.

This is a bit tricky, because they have to put version numbers in the .dll/.so/.jnilib filenames to keep SWT apps with different versions from conflicting with each other. They also have a particular order that they try these paths in, since on some systems the library paths aren't writable by the user.

As far as I know, this is a limitation of the OSes, not Java -- operating system functions to load dynamic libraries always seem to take file paths, not streams