0

I made a game that uses external libraries and resource files. Now I want test it on another PC(with Ubuntu OS), I tried to run it without eclipse by exporting to jar files, but it doesn't work. This is the hierarchy. Is there any simple way to do this ?

Edit When I export it as Runnable(Note that I'm trying to run it still on windows not ubuntu) jar file and try to run it java -jar gra.jar It throws:

`Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:58)
Caused by: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
        at java.lang.Runtime.loadLibrary0(Runtime.java:845)
        at java.lang.System.loadLibrary(System.java:1084)
        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:132)
        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 MainWindow.main(MainWindow.java:14)
        ... 5 more`
ashur
  • 3,661
  • 12
  • 46
  • 76
  • Have you tried running it with 'java -jar ' - what happens? – david99world Nov 25 '12 at 13:03
  • At first time I used another options to export and it threw exception. And now I get `no main manifest attribute, in game.jar`. I'll try again export to show this exception. – ashur Nov 25 '12 at 13:07
  • Have you tried putting the native files in the same directory as the jar file? – Oskar Nov 25 '12 at 18:49
  • @Oskar Well, after few attempts I tried this and It worked, I guess It's the simplest way:P – ashur Nov 26 '12 at 21:33

3 Answers3

0

Make sure you are getting your resource files correctly, not referencing them in your local file system.

To ensure your resources are put in the JAR add them to your classpath.

Community
  • 1
  • 1
Garrett Hall
  • 27,772
  • 10
  • 56
  • 73
0

Caused by: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path

lwjgl is not found. It should be in one of the directories listed in java.library.path.

You most certainly added a directory to java.library.path with the native dlls of jwgl when you set up your project. Eclipse cannot export this. You will have to create a starter script (sh, bat) which adds the dlls.

Have a look at the last step here: http://www.lwjgl.org/wiki/index.php?title=Setting_Up_LWJGL_with_Eclipse

atamanroman
  • 10,631
  • 6
  • 51
  • 77
  • I'm confused a little, because this link has info about setting up whole project what I did. And last step has also been done in my case. – ashur Nov 25 '12 at 14:22
  • 1
    Yes you did that right. However, if you do export as a jar, eclipse can't add the dlls to the java.library.path for you. You have to do that yourself. E.g.: `java -Djava.library.path=my/dll/folder -jar my.jar`. You could also use `System.loadLibrary()` and put the dlls in your jar. – atamanroman Nov 25 '12 at 16:35
0

How did you pack the jar? If you used solely eclipse, you should use jarsplice. That may fix the error

sandspro
  • 72
  • 1
  • 6