UnsatisfiedLinkError: no lwjgl in java.library.path

Hi folks,

I have been following this forum as a guest for a while …
And I would like to join in :slight_smile:

I’m Dane, running Java in Eclipse, using Ubuntu (Linux).
Rather new to Java, but I have been coding for some years.

I have recently installed Slick (+lwjgl+phys2d) as mentioned by some of you.

Then I finally made a program, that was allowed to run on my wifes computer too (Tetris ;))
But when making a JAR file and trying to run it, I get the same error as GustavXIII.

That is when I create an export to Java/Runnable JAR-files, it gives me a:
“no lwjgl in java.library.path”

Then i tried to make a “normal” Java/JAR-file export, which results in an:
“Exception in thread “main” java.lang.NoClassDefFoundError: org/newdawn/slick/state/StateBasedGame”

As said, I’m new to Java, and I’ve spend last night and most of the day today (it’s almost 4pm in DK) making it work.
I hope that someone has a solution, or maybe a hint for me :slight_smile:

Regards
niq

Maybe use Java Web Start as it is explained here in Slick Wiki:
http://slick.cokeandcode.com/wiki/doku.php?id=webstart

If I disable FModEx then I can start my game from the jar.
But I dont know where the error is with FMod…

@gouessej I will try it tomorrow.

@niq Ive done the 2 steps from here:
http://lwjgl.com/wiki/index.php?title=Distributing_Your_LWJGL_Application
I’d made the Manifest and the bat.
Now lwjgl work so you could try it too.

Hi again

I would like to thank you for your help :slight_smile:

But I could not get it to work though (the manifest thing) but I was lead to this page:
http://lwjgl.com/wiki/index.php?title=Distributing_Your_LWJGL_Application
where I found a solution which seems to work … using JarSplice.

I downloaded JarSplice from ninjacave.com/jarsplice

Now my wife can start playing Tetris :wink:

Regards
niq

I tryed JarSplice too but it always say after I execute the Jarfile: “FATAL ERROR, corrupted File” oO"
Maybe I downloadet a version with errors…

Ok. You can have a look at the JNLP file used by the game “Flesh Snatcher” in the showcase section, it relies on LWJGL. Just replace the line handling LWJGL by the line handling Slick & LWJGL at the same time, replace its JAR by yours, sign all JARs with the same signature and upload your JAR and your JNLP file onto a server.

@GustavXIII
The first JAR-file I created was also corrupted :frowning:

This time I followed this video on “youtube”

It seems to be working :slight_smile:

Regards

niq, double-clicking onto a JAR file under Windows opens WinRar by default whereas it works fine on Mac. That’s why I advise you to use Java Web Start, an applet or another installer.

@gouessej
Thanks for your advise :slight_smile:
I’ll be looking at that next time I have to deploy a program …
I also saw you can change .JAR files to .EXE (Win32) … I didn’t read further than that, and don’t know more about it.
But would that be recommendable too? … I’m aware that it doesn’t run under other systems.

Regards

You’re welcome. I would like to see your game(s) in the showcase section ;D Let me know whether you’re ready and I will try to help you as much as I can.

You obviously know this solution is not cross-platform. Some programmers here prefer hiding Java and use tools to perform deep native integration. I advise you to look at this, this sums up the situation pretty well:
http://www.excelsior-usa.com/articles/java-to-exe.html

Excelsior JET makes very zippy exes, but costs mui dinero, and gcj is a toy that’s slower than hotspot. Launch4j may be more what you’re looking for.

Launch4j is an amazing tool which all Java programmers SHOULD be using. I also recommend that.

Ive tried Launch4j but I get an error. I have the JRE!

[quote]Compiling resources
C:\Program Files (x86)\Launch4j\bin\windres.exe: icon file `C:\Users*\Downloads\Balmung Cycle\Picture\01.png’ does not contain icon data
Generated resource file…

LANGUAGE 0, 1
2 RCDATA BEGIN “1.5.0\0” END
18 RCDATA BEGIN “1\0” END
25 RCDATA BEGIN “16\0” END
27 RCDATA BEGIN “256\0” END
1 ICON DISCARDABLE “C:\Users\*\Downloads\Balmung Cycle\Picture\01.png”
21 RCDATA BEGIN “http://java.com/download\0” END
8 RCDATA BEGIN “.\0” END
20 RCDATA BEGIN “32\0” END
101 RCDATA BEGIN “An error occurred while starting the application.\0” END
102 RCDATA BEGIN “This application was configured to use a bundled Java Runtime Environment but the runtime is missing or corrupted.\0” END
103 RCDATA BEGIN “This application requires a Java Runtime Environment\0” END
104 RCDATA BEGIN “The registry refers to a nonexistent Java Runtime Environment installation or the runtime is corrupted.\0” END
15 RCDATA BEGIN “masterDestroyer.Main\0” END
16 RCDATA BEGIN “lib\lwjgl.jar;lib\slick.jar;lib\jinput.jar;lib\jogg-0.0.7.jar;lib\jorbis-0.0.15.jar;lib\NativeFmodEx.jar;lib\NativeFmodEx-win.jar;lib\NativeFmod-win64.jar;lib\libLibLoader.so;lib\libLibLoader64.so;lib\libNativeFmodEx.jnilib;lib\libNativeFmodEx.so;lib\libNativeFmodEx64.so;natives\lwjgl.dll;natives\jinput-dx8.dll;natives\OpenAL32.dll;natives\jinput-dx_64.dll;natives\jinput-raw.dll;natives\jinput-raw_64.dll;natives\OpenAL64.dll;natives\NativeFmodEx.dll;natives\NativeFmodEx64.dll\0” END
14 RCDATA BEGIN “Master Destroyer.jar\0” END

net.sf.launch4j.ExecException: Exec failed (1): C:\Program Files (x86)\Launch4j\bin\windres.exe --preprocessor=type -J rc -O coff -F pe-i386 C:\Users*\AppData\Local\Temp\launch4j4462530439501924539rc C:\Users\Oliver\AppData\Local\Temp\launch4j7292897449556024572o
Compiling resources
C:\Program Files (x86)\Launch4j\bin\windres.exe: icon file `C:\Users*\Downloads\Balmung Cycle\Picture\01.png’ does not contain icon data
Generated resource file…

LANGUAGE 0, 1
2 RCDATA BEGIN “1.5.0\0” END
18 RCDATA BEGIN “1\0” END
25 RCDATA BEGIN “16\0” END
27 RCDATA BEGIN “256\0” END
1 ICON DISCARDABLE “C:\Users\*\Downloads\Balmung Cycle\Picture\01.png”
21 RCDATA BEGIN “http://java.com/download\0” END
8 RCDATA BEGIN “.\0” END
20 RCDATA BEGIN “32\0” END
101 RCDATA BEGIN “An error occurred while starting the application.\0” END
102 RCDATA BEGIN “This application was configured to use a bundled Java Runtime Environment but the runtime is missing or corrupted.\0” END
103 RCDATA BEGIN “This application requires a Java Runtime Environment\0” END
104 RCDATA BEGIN “The registry refers to a nonexistent Java Runtime Environment installation or the runtime is corrupted.\0” END
15 RCDATA BEGIN “masterDestroyer.Main\0” END
16 RCDATA BEGIN “lib\lwjgl.jar;lib\slick.jar;lib\jinput.jar;lib\jogg-0.0.7.jar;lib\jorbis-0.0.15.jar;lib\NativeFmodEx.jar;lib\NativeFmodEx-win.jar;lib\NativeFmod-win64.jar;lib\libLibLoader.so;lib\libLibLoader64.so;lib\libNativeFmodEx.jnilib;lib\libNativeFmodEx.so;lib\libNativeFmodEx64.so;natives\lwjgl.dll;natives\jinput-dx8.dll;natives\OpenAL32.dll;natives\jinput-dx_64.dll;natives\jinput-raw.dll;natives\jinput-raw_64.dll;natives\OpenAL64.dll;natives\NativeFmodEx.dll;natives\NativeFmodEx64.dll\0” END
14 RCDATA BEGIN “Master Destroyer.jar\0” END

net.sf.launch4j.ExecException: Exec failed (1): C:\Program Files (x86)\Launch4j\bin\windres.exe --preprocessor=type -J rc -O coff -F pe-i386 C:\Users*\AppData\Local\Temp\launch4j4462530439501924539rc C:\Users\Oliver\AppData\Local\Temp\launch4j7292897449556024572o
[/quote]
And I dont know why I get the error with FModEx then I use my .bat.

Hi gouessej and you other folks :slight_smile:

Thanks for advises and encouragement :slight_smile:
I’ll be looking at Launch4J soon … Now I first have to make something worth deploying :wink:
The Tetris game was from Spiegel’s tutorial on one of the Slick pages, and not my own creation …
Now I have Slick, I don’t even know which game to start coding :-
Maybe I should be playing a little with new graphic commands and see if I get any good ideas …

Thanks again and regards

I cant fix FMod.
What are you guys using to play Music and Sounds and did it work with .jar?

Hi GustavXIII

I don’t know about FMod, and have only a little experience with sounds in Java until now.
I use Slick to play music and sounds in my game … seems to work fine - also in Jars (with the remark that all files in my project is in the src directory).
It’s just a slow starter (3 seconds for a 3MB ogg music file).

I hope you can use this information :slight_smile:

Regards

FMod works fine, just do it right ;D

Slick uses LWJGL which uses OpenAL - you can use that too

Then tell me how. I put every .jar and .dll in the directory??
And Init.loadLibraries does not work.

I will try using Slick to play music thanks.

EDIT: OK it work with Slick I dont need FMod xD"

Hey Gustav and other members who are having this problem.

I’ve been using Slick for a while and have been using it to package .jars. The error is caused when the natives are not in the same directory as the .jar. If you bundled them with the .jar, this error will keep appearing.

There are a lot of natives bundled with Slick. The fastest way is to find the natives that are for your specific OS and put your .jar in a separate folder along with the natives. A quick example for Windows…

<New Folder Contents: blah.jar, lwjl.dll, OpenA32.dll, jinputraw.dll, jinputdx8.dll>

I just piled all the natives into a folder called native.

native/natives-win32 (Windows Natives)
native/natives-linux (Linux natives)
native/natives-mac (Mac natives)

Then I put that folder in the same folder as the .jar

blah.jar, native(DIR) [contains the natives]

Then put this line when running Java…

java -Djava.library.path=native\natives-win32;lib\native\natives-linux;lib\natives\natives-mac -jar blah.jar

Of course, you can always use the bundling programs suggested if you wanted to package it as a single .jar. But hopefully this helps.