SFML community forums

Bindings - other languages => Java => Topic started by: Marc15 on May 16, 2013, 07:30:06 am

Title: I cannot run a JSFML application (UnsatisfiedLinkError)
Post by: Marc15 on May 16, 2013, 07:30:06 am
Hi,

I decided to try JSMFL. I use Ubuntu 13.04, Eclipse, and of course Java. All of them are 64 bits.

I created a project in Eclipse and I added jsfml.jar in the classpath.

I copied the following code from the tutorial.

package ca.USERNAME.sandbox.jsfml;

import org.jsfml.graphics.Color;
import org.jsfml.graphics.RenderWindow;
import org.jsfml.window.VideoMode;
import org.jsfml.window.event.Event;

public class JSFMLTest {

        /**
         * @param args
         */

        public static void main(String[] args) {
                System.out.println("JSFMLTest");
               
                RenderWindow window = new RenderWindow();
                window.create(new VideoMode(640, 480), "Hello JSFML!");
               
                window.setFramerateLimit(30);
               
                while (window.isOpen()) {
                        window.clear(Color.RED);
                       
                        window.display();
                       
                        for (Event event : window.pollEvents()) {
                                if (event.type == Event.Type.CLOSED) {
                                        window.close();
                                }
                        }
                }
        }

}
 

Eclipse doesn't report any error, except when I run the code. This happens :

JSFMLTest
Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/USERNAME/.jsfml/linux_x64/libsfml-graphics.so: libGLEW.so.1.6: cannot open shared object file: No such file or directory
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1935)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1860)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1821)
        at java.lang.Runtime.load0(Runtime.java:792)
        at java.lang.System.load(System.java:1059)
        at org.jsfml.internal.SFMLNative.loadNativeLibraries(Unknown Source)
        at org.jsfml.internal.SFMLNativeObject.<init>(Unknown Source)
        at org.jsfml.window.Window.<init>(Unknown Source)
        at org.jsfml.graphics.RenderWindow.<init>(Unknown Source)
        at ca.mfcochauxlaberge.sandbox.jsfml.JSFMLTest.main(JSFMLTest.java:16)
 

The .jsfml folder does exist in my user directory. According to my package manager, libGLEW 1.9 is installed. Could this be the problem? It needs 1.6? If I remember correctly, I read in another post that libGLEW is already inside jsfml.jar, so I don't know what to do.

When I run the test application, I get the exact same error.

Thanks for you help.
Title: Re: I cannot run a JSFML application (UnsatisfiedLinkError)
Post by: pdinklag on May 19, 2013, 03:53:33 pm
Hm, this is awkward, because libGLEW should be linked statically into JSFML and not even be a dependency. I chose to do it that way so it's no problem if people got a "wrong" version of GLEW like you do. So there's nothing wrong about your setup, it should be working.

May I ask which version you are using? Is it test release #2? Maybe I did a mistake packaging it up.
Title: Re: I cannot run a JSFML application (UnsatisfiedLinkError)
Post by: Marc15 on May 21, 2013, 01:21:19 am
Yes, I'm using the second release.

I had to reinstall my computer and this time, I chose Fedora with Xfce instead of Ubuntu. I decided to give it another try, but I got the exact same error.
Title: Re: I cannot run a JSFML application (UnsatisfiedLinkError)
Post by: pdinklag on May 21, 2013, 07:34:39 am
I just had a look at the binaries in there. Indeed, it looks like libGLEW is not statically linked, so it won't work.
I'll build a new package later and post it here, however, for a 3rd test release I'll need a Mac version. Gonna take care of that.

Thanks for reporting and sorry for the inconvenience.
Title: Re: I cannot run a JSFML application (UnsatisfiedLinkError)
Post by: Marc15 on May 22, 2013, 01:03:21 am
No problem.

Thanks a lot for the good work.
Title: Re: I cannot run a JSFML application (UnsatisfiedLinkError)
Post by: Syndog on June 08, 2013, 04:03:06 am
Hey guys, I just ran into this same problem running JSFML on Linux as well.  Did you manage to get the fixed version in place?  The latest link I see on the download page is dated January 2013...

Thanks!   ;D

Title: Re: I cannot run a JSFML application (UnsatisfiedLinkError)
Post by: Sonkun on June 13, 2013, 10:34:03 pm
I'm fixing them (https://github.com/Sonkun/JSFML). Once I'm done, I'll pull request my changes :)

Edit: Ubuntu and Fedora packages will follow.
Title: Re: I cannot run a JSFML application (UnsatisfiedLinkError)
Post by: pdinklag on June 16, 2013, 06:28:24 pm
Sorry for the huge delay, I packed up another test release which includes the performance updates from earlier this year and a statically linked libglew that should fix the issue at hand.
Title: Re: I cannot run a JSFML application (UnsatisfiedLinkError)
Post by: Syndog on June 16, 2013, 11:52:25 pm
Thank you for the update!   8)

D.