Dynamic loading of the .DLLs - hitting a snag

How’s about just a static call, passing in the path to your lib directory?

Bugger. Like I expected then.

I don’t know if that solution would be any better than just shipping the natives unpacked and I guess that java doesn’t allow you to mount a virtual filesystem in RAM memory either ?

// Tomas

// Tomas

It would still enable them to make a function to load the libs dynamically for the right os without the user needing to use -Djava.library.path.

Incidentally, does anyone know of a way to do the noddraw workaround in code?

True.

I suggested some extracting/loading procedure to someone a while ago http://192.18.37.44/forums/index.php?topic=10074.msg79958#msg79958
Still haven’t tried it though. Maybe if you combine it with File#deleteOnExit to avoid littering the disk with libraries it might work :slight_smile:

Ken, we’re still having trouble, with the code posted above, getting jawt loaded on OS X. Any more suggestions from your bag of tricks?

Could you please post the exception stack trace?

Sure, as soon as my tester with the Mac gets online :slight_smile:

Hello,
Thank you very much for the useful info you provide.
I tried the dynamic loading of the native libraries, and it works fine under windows and linux.

I had a problem on mac, but finally I managed to figure it out.
So it works now on mac as well!
The difference from Jaeden’s code is, that I do not load jawt on mac.
I had a lot of trouble from mismatching versions of jar and native files.
Hope this helps.

Hi,
i’m trying to do the same things by loading the DLLs and the jar file from my code but i’m not able.

Here is the code i use (same as Jaeden):


        //Allow loader
        NativeLibLoader.disableLoading();

        //Seems to have to load awt first
        java.awt.Toolkit.getDefaultToolkit();
        System.loadLibrary("jawt"); 
        
        //Load the jogl jar file
        URL urlJOGL = (new File(ThinClient.getPath() + "jogl.jar")).toURL();
        URL[] urls = { urlJOGL };            
        URLClassLoader classLoader = new URLClassLoader(urls);

        //Load the DLLs
        System.load(ThinClient.getPath() + "jogl.dll");
        System.load(ThinClient.getPath() + "jogl_awt.dll");

After this, i’m getting this error


java.lang.NoClassDefFoundError: com/sun/opengl/impl/NativeLibLoader
...

It was like if my jar wasn’t loaded. Anybody have an idea?

I want to do this cause on Windows i’m able to put the jar into the lib/ext folder and the DLLs into the bin folder of the JRE the first time, but i need a cross platform solution. On Linux i can’t do this, cause the JRE folders are 99% with root acces, so i cannont use this method with normal user. This solution seems good cause i put the files into the home directory of the user (i’ll adapt the code for others os after i’ll be able to load the stufss dynamically).

thx a lot!!!

I finaly use Java WebStart and that working very well

thx a lot
i’m leaving this topic