I am running a program fine in the IDE, however out of the IDE in its own jar file, as soon as I export it as a runnable jar file (and make it a fat jar, add the libraries and natives, etc), it gives the following error:
Exception in thread "main" java.lang.NoSuchMethodError: getPointer
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1854)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at org.lwjgl.Sys$1.run(Sys.java:72)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.Sys.doLoadLibrary(Sys.java:65)
at org.lwjgl.Sys.loadLibrary(Sys.java:81)
at org.lwjgl.Sys.<clinit>(Sys.java:98)
at org.lwjgl.opengl.Display.<clinit>(Display.java:128)
at Joehot200.TerrainDemo.setUpDisplay(TerrainDemo.java:1956)
at Joehot200.TerrainDemo.startGame(TerrainDemo.java:2029)
at Joehot200.Main.main(Main.java:55)
And my set up display method is:
private static void setUpDisplay() {
try {
DisplayMode displayMode = null;
DisplayMode[] modes = Display.getAvailableDisplayModes(); //this is line 1956
for (int i = 0; i < modes.length; i++)
{
if (modes[i].isFullscreenCapable())
{
displayMode = modes[i];
}
}
if (displayMode == null){
displayMode = new DisplayMode(100, 100);
}
//Display.setDisplayMode(new DisplayMode(WINDOW_DIMENSIONS[0], WINDOW_DIMENSIONS[1]));
Display.setDisplayMode(displayMode);
Display.setResizable(true);
Display.setTitle("Pirate game");
//Display.setFullscreen(true);
Display.create();
} catch (LWJGLException e) {
e.printStackTrace();
cleanUp(true);
}
}
How can I fix the stupid error and make it work?
.dll
,.so
etc.) the problem might be that those are not found by your fat jar. So you might need to provide those libraries in a location that can be found by lwjgl.