Running jar files on Linux

Hey guys I’m using Linux for the first time ever and running Fedora 21.
I’m working on a game using libGdx but when I run the project through eclipse or a runnable Jar i get this error:

LwjglApplication: Couldn’t initialize audio, disabling audio
java.lang.UnsatisfiedLinkError: /tmp/libgdxandre4/1c78875b/liblwjgl.so: libjawt.so: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1814)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1083)
at org.lwjgl.Sys$1.run(Sys.java:70)
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.(Sys.java:117)
at org.lwjgl.openal.AL.(AL.java:59)
at com.badlogic.gdx.backends.lwjgl.audio.OpenALAudio.(OpenALAudio.java:72)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.(LwjglApplication.java:83)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.(LwjglApplication.java:64)
at com.me.mygdxgame.Main.main(Main.java:25)
Exception in thread “LWJGL Application” java.lang.NoClassDefFoundError: Could not initialize class org.lwjgl.Sys
at org.lwjgl.opengl.Display.(Display.java:135)
at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.setVSync(LwjglGraphics.java:446)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:118)

My assumptions woiuld be something related to openGL, I’m using a recycled Lenovo ThinkPad x230i. When this computer was running windows I would have no problems executing the file.

I installed the JDK via Oracle website and downloaded the .rpm. I did not use the terminal to install it. I’m not sure if there is a difference.
I tried downloading and installing the latest Intel drivers for Linux, I’m not sure if it’s acutally installing correctly, again doing this outside of the terminal.

I really want to use Fedora as my main OS for developing cause it’s quite smooth and very light.

EDIT: I just downloaded the libGdx setup app (gdx-setup.jar) and tried to run it

and I got this:

Exception in thread “main” java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:207)
at java.awt.Window.(Window.java:536)
at java.awt.Frame.(Frame.java:420)
at java.awt.Frame.(Frame.java:385)
at javax.swing.JFrame.(JFrame.java:181)
at com.badlogic.gdx.setup.GdxSetupUI.(Unknown Source)
at com.badlogic.gdx.setup.GdxSetup.main(Unknown Source)

:frowning:

You can assume that the system is finding Java correctly due to the exceptions emanating from Java instead of being a standard shell exception.

Looking at the first part of your post, it would appear that the application can’t find the shared object files (.so files are equivalent to .dll files in Windows) for LibGDX. Did you make sure to copy the appropriate .so files to somewhere in your applications class path? As a test, try putting them in the same folder as your .jar file and seeing if that alleviates the issue.

As for OpenGL being the source of the issue, the first error is related to audio, not video. The second error isn’t quite as specific, but my guess is that it’s something related to libawt.so. Copying the files as suggested in the last paragraph may alleviate this issue as well. Post the results and if you’re still stuck, somebody around here should be able to get you over the hump. :slight_smile:

Thanks @CodeHead

Managed to solved it just now. Apparently the issue was with the JRE I was using. First thing I did after installing Linux was install the JDK. The JRE that is installed with it or at least being used by it is java-1.8.0-openjdk-1.8.0.25-4.b18.fc21.i386 . Which is quite strange. I don’t usually install JRE on windows machines because they come with the JDK.

So what I did was i downloaded just the JRE and reconfigured which JRE to use to the new one which is jre1.8.0.40 . I don’t have much experience with the prior JRE openjdk so I can’t say much about it.

I don’t know if this is the case for all Linux installations why the default JRE being used is the prior one or just me.

OpenJDK JDK 1.8 RPM packages are called java-1.8.0-openjdk-devel. I use LibGDX occasionally under Mageia Linux 4 with OpenJDK 1.8 and I have no such trouble. Your trouble comes from a (fixed?) bug (or a known regression) in your library:
http://forum.lwjgl.org/index.php?topic=4085.msg22081#msg22081
https://bbs.archlinux.org/viewtopic.php?pid=975456#p975456