dimanche 10 mai 2015

Slick2D test application resulting in UnsatisfiedLinkException: wrong ELFCLASS

I'm writing a java-based game, trying to use Slick2D. However, when I try running the test application (below), I get this:

OpenJDK Server VM warning: You have loaded library /home/andrzej/Programming/Java/HeroesOfZether/lib/lwjgl/native/linux/liblwjgl.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/andrzej/Programming/Java/HeroesOfZether/lib/lwjgl/native/linux/liblwjgl.so: /home/andrzej/Programming/Java/HeroesOfZether/lib/lwjgl/native/linux/liblwjgl.so: wrong ELF class: ELFCLASS64 (Possible cause: architecture word width mismatch)
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1880)
    at java.lang.Runtime.loadLibrary0(Runtime.java:849)
    at java.lang.System.loadLibrary(System.java:1088)
    at org.lwjgl.Sys$1.run(Sys.java:72)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
    at org.lwjgl.Sys.loadLibrary(Sys.java:96)
    at org.lwjgl.Sys.<clinit>(Sys.java:117)
    at org.lwjgl.opengl.Display.<clinit>(Display.java:135)
    at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36)
    at simpleslickgame.SimpleSlickGame.main(SimpleSlickGame.java:34)

I have done exactly like the tutorial on Slick2D said, downloaded and unpacked slick and lwjgl archives, created a User Library, added run VM argument referencing the folder with natives (liblwjgl.so, liblwjgl32.so, libopenal.so, libopenal32.so), as you can see JVM finds them no problem, but then it encounters an architecture conflict. I am running Eclipse on 32-bit Linux Mint, with JDK and all properly installed and configured, I made a few small applications before without problem. There are no separate 32bit download options available on LWJGL site, and removing both the libraries without "32" in their name results back in UnsatisfiedLinkException: no lwjgl in java.library.path. This is the test application code:

package simpleslickgame;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;

public class SimpleSlickGame extends BasicGame
{
    public SimpleSlickGame(String gamename)
    {
        super(gamename);
    }

    @Override
    public void init(GameContainer gc) throws SlickException {}

    @Override
    public void update(GameContainer gc, int i) throws SlickException {}

    @Override
    public void render(GameContainer gc, Graphics g) throws SlickException
    {
        g.drawString("Howdy!", 10, 10);
    }

    public static void main(String[] args)
    {
        try
        {
            AppGameContainer appgc;
            appgc = new AppGameContainer(new SimpleSlickGame("Simple Slick Game"));
            appgc.setDisplayMode(640, 480, false);
            appgc.start();
        }
        catch (SlickException ex)
        {
            Logger.getLogger(SimpleSlickGame.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

Can someone please tell me what am I doing wrong and how to fix it?

Aucun commentaire:

Enregistrer un commentaire