lwjgl.dll: Can’t load IA 32-bit .dll on a AMD 64-bit platform

If you encounter this error while trying to write a game on a Windows 64 bit system using Slick2d, I can give you some insight into how to fix the issue. I’d ran into this issue some time ago, but I don’t remember if I posted about it or not. I solved the problem then by using a recompiled version of slick2d. It worked well, but I did something different this time around.

I downloaded the latest version of LWJGL and used it instead. The process of importing the libs is much the same except you use the new LWJGL and its natives instead of the ones included with slick2d. If you need help getting the imports correct, leave a comment and I’ll go into it in more detail.

Adding Slick 2D and lwjgl to Eclipse Project

I spent some time today trying to get Slick and the light-weight java game library setup correctly in Eclipse. The tutorial I was watching was in Netbeans and I was very unfamiliar with adding libraries to a Java project in Eclipse (very familiar now). I’m going to go over how to do this as an overview, mainly just to remind me how to do it later hehe. It may also be of use to others who don’t need a step by step picture guide of the process. So, here goes!

  1. Create a new project in Eclipse
  2. Right-click the project and choose New -> Folder (call it “lib”)
  3. Right-click the lib folder and choose Import… then General -> File System
  4. Browse to your slick folder and choose the slick.jar and the lwjgl.jar files.
  5. Right-click on the project and choose Properties
  6. Choose “Java Build Path” and click the “Libraries” tab
  7. Click “Add Jars”. It will show a tree of your project. Expand it till you see your lib folder. Expand it. Select the two jars (utilize shift for multiple selection). Click OK.
  8. Click OK again to go out to the workspace.
  9. Right-click on the lib folder and Import again. This time use “Archive File” instead of “File System”. Click Next.
  10. Browse to your slick lib folder and find “natives-win32.jar”. Click open.
  11. It will list some dlls on the right column. Make sure they are all checked and click finish.
  12. Repeat steps 9-11 and add the natives for mac and linux the same way if you want them.
  13. Now you need to add those natives to lwjgl. So…
  14. Right-click on the project and choose properties.
  15. In the Java Build Path -> Libraries tab, expand lwjgw.jar and click on Native library location.
  16. Click Edit. Click Workspace. Navigate to the lib folder, choose it, and click OK.
  17. NOW ALMOST THERE!
  18. Back in the Java Build Path -> Libraries, expand slick.jar. Click JavaDoc location.
  19. Click Edit. Set the javadoc location path to the location of the slick\javadoc folder.

Step 20… Add a class to your project and see if it will compile correctly. Here’s an example for testing.

GameTest.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
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 Game extends BasicGame {
	public Game(String title) { super(title); }
 
	public static void main(String[] args) throws SlickException {
		AppGameContainer app = new AppGameContainer(new Game("Test Game"));
		app.start();
	}
 
	@Override
	public void render(GameContainer container, Graphics g)	throws SlickException {
		g.drawString("Hello, World!", 0, 100);
	}
 
	@Override
	public void init(GameContainer container) throws SlickException {
 
	}
 
	@Override
	public void update(GameContainer container, int delta) throws SlickException {
 
	}
}