Hello I am working on a project in Eclipse and am trying to export it so I can send it to some friends. I am clueless as to how to export so I watched some YouTube videos because that's all I could find on the topic. The video said to;
Then I attempted to launch it on my desktop from double-click, nothing. Then I tried from command prompt with "java -jar my_jar_name.jar" and it threw this error:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at org.lwjgl.Sys$1.run(Sys.java:73)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
at org.lwjgl.Sys.loadLibrary(Sys.java:95)
at org.lwjgl.Sys.<clinit>(Sys.java:112)
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 javaGame.Game.main(Game.java:37)
... 5 more
Here is my main method in my project:
FYI: The first line is line #34 and the last is #43
public static void main(String[] args) {
AppGameContainer appgc;
try{
appgc = new AppGameContainer(new Game(gamename));
appgc.setDisplayMode(appgc.getScreenWidth(), appgc.getScreenHeight(), true);
appgc.start();
}catch(SlickException e){
e.printStackTrace();
}
}
If more info is needed please let me know!
P.S. This is the first Java project in Eclipse I have wanted to export so no I have not done it before.
I figured it out after referencing another Stack Overflow question I just found moments ago. I used JarSplicer to create a Fat Jar that included the natives into my jar and it worked perfectly. I can now run my app by double clicking it and it runs just like in Eclipse, thank you for your support!