Login  Register

Re: Return of the "java.lang.UnsatisfiedLinkError: Can't load library: /System/Library/Frameworks/gluegen-rt.Framework/gluegen-rt" exception...

Posted by Wade Walker on Jun 03, 2015; 1:24am
URL: https://forum.jogamp.org/Return-of-the-java-lang-UnsatisfiedLinkError-Can-t-load-library-System-Library-Frameworks-gluegen-rt-tp4034549p4034589.html

Alexis Drogoul wrote
Notice the difference ? His installation of Eclipse Luna is in a folder called "Eclipse Luna" (*with* a space), mine is in "eclipse" (*no* space).
Ah, now I remember this. I ran into this at some point, but forgot about it :) Turns out, there's an error in Eclipse's FileLocator.resolve() where it doesn't escape spaces properly (the bug report is at https://bugs.eclipse.org/bugs/show_bug.cgi?id=145096). Apparently a lot of Eclipse legacy code depends on this wrong behavior, so it doesn't sound like they're going to fix it.

A fix we can do on our side is to change the resolver you create in your code to escape the spaces properly. Apparently if you change the resolved URL to a URI using the 3-argument constructor, then back to an URL, it'll escape it for you, like so:

JarUtil.setResolver( new JarUtil.Resolver() {
    public URL resolve( URL url ) {
        try {
            URL urlUnresolved = FileLocator.resolve( url );
            URL urlResolved = new URI( urlUnresolved.getProtocol(), urlUnresolved.getPath(), null ).toURL();
            return( urlResolved );
        }
        catch( IOException ioexception ) {
            return( url );
        }
        catch( URISyntaxException urisyntaxexception ) {
            return( url );
        }
    }
} );

I haven't tested this fully, but I think this is how I did it. Not sure why this isn't in my current code base, I must have done it in a branch somewhere and forgotten it.