Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  Print  
  UnsatisfiedLinkError: no lwjgl in java.library.path  (Read 2196 times)
0 Members and 2 Guests are viewing this topic.
Offline GustavXIII

Jr. Member
**

Posts: 57



« on: 2012-01-06 08:48:18 »

Hi!
Is someone using Slick and can make a executable jar?
If I start my game throught netbeans it run 100%.

Now I wanted to make a .jar.
But when I execute my .jar from the dist directory I get an error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path

I found many threads on google but no real solution.
I put the lwjgl.dll in my lib directory an change the VM Path to that but still the error.

Had someone the same problem?


Offline gouessej

JGO Kernel
*****

Posts: 3560
Medals: 30


TUER


« Reply #1 on: 2012-01-06 09:10:00 »

Hi

Why not using Java Web Start as you already have a JAR for your application and using a third party library like LWJGL only requires to add a single line into a JNLP file?

Have you read this?
http://slick.cokeandcode.com/wiki/doku.php?id=webstart

When you use Slick with Java Web Start, LWJGL is bundled with it, you don't have to deploy it separately:
Quote
<extension href="http://slick.cokeandcode.com/demos/slick.jnlp" version="0.4"/>

Use the command "javaws" instead of "java -jar" to test your JNLP file.

I don't know whether it is possible to create a fat JAR containing both your game, Slick and LWJGL. At a certain step, native libraries have to be unpacked (from the JAR), don't they? You can put native libraries into a given directory and set the Java library path in order to tell the JVM where to find them.

Julien Gouesse
Offline ra4king

JGO Kernel
*****

Posts: 3160
Medals: 196


I'm the King!


« Reply #2 on: 2012-01-06 09:14:31 »

http://lwjgl.com/wiki/index.php?title=Distributing_Your_LWJGL_Application

Look at bullets 1 and 2.

Games published by our own members! Go get 'em!
Offline Cero

JGO Neuromancer
****

Posts: 1050
Medals: 18



« Reply #3 on: 2012-01-06 10:59:44 »

always a pain
I use the eclipse export thing, which works great - it puts the jars that you need wherever you want, inside the jar or not
then you still have to have a folder with all the lwjgl native files
and do -Djava.library.path=natives_folder

Offline gouessej

JGO Kernel
*****

Posts: 3560
Medals: 30


TUER


« Reply #4 on: 2012-01-09 05:31:09 »

always a pain
I use the eclipse export thing, which works great - it puts the jars that you need wherever you want, inside the jar or not
then you still have to have a folder with all the lwjgl native files
and do -Djava.library.path=natives_folder
It won't work on all platforms as you can set only a single path. Is it possible to bundle all native libraries of LWJGL into a JAR and use a mechanism of dynamic loading (able to extract native libraries and load them at runtime)?

Julien Gouesse
Offline GustavXIII

Jr. Member
**

Posts: 57



« Reply #5 on: 2012-01-09 06:26:48 »

Ive changed the manifest but it still wont work:

My game directory:
http://www.bilder-space.de/show_img.php?img=bae287-1326108110.png&size=original
lib directory:
http://www.bilder-space.de/show_img.php?img=dd7a73-1326108227.png&size=original
native directory:
http://www.bilder-space.de/show_img.php?img=5f889c-1326108252.png&size=original

my manifest:
Quote
Manifest-Version: 1.0
Main-Class: masterDestroyer.Main
Class-Path: lib/lwjgl.jar lib/slick.jar lib/jinput.jar lib/jogg-0.0.7.jar lib/jorbis-0.0.15.jar lib/NativeFmodDesigner.jar lib/NativeFmodDesigner-win.jar lib/NativeFmodDesigner-win64.jar lib/NativeFmodEx.jar lib/NativeFmodEx-win.jar lib/NativeFmod-win64.jar lib/libLibLoader.so lib/libLibLoader64.so lib/libNativeFmodDesigner.jnilib lib/libNativeFmodDesigner.so lib/libNativeFmodDesigner64.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/NativeFmodDesigner.dll natives/NativeFmodDesigner64.dll natives/NativeFmodEx.dll natives/NativeFmodEx64.dll

start.bat include this:
java -Djava.library.path="natives/" -jar "Master Destroyer.jar"

If i execute start i get this error he cant find fmodex
http://www.bilder-space.de/show_img.php?img=41aeeb-1326108356.png&size=original
Offline Cero

JGO Neuromancer
****

Posts: 1050
Medals: 18



« Reply #6 on: 2012-01-09 07:12:30 »

always a pain
I use the eclipse export thing, which works great - it puts the jars that you need wherever you want, inside the jar or not
then you still have to have a folder with all the lwjgl native files
and do -Djava.library.path=natives_folder
It won't work on all platforms as you can set only a single path....

No idea what you mean - it does work on all platforms. the eclipse export thing takes charge of the external jars I use; while I just say -Djava.library.path=lib.
and in the lib folder (not a jar), there are all the natives for all platforms

Offline Orangy Tang

JGO Kernel
*****

Posts: 2960
Medals: 37


Monkey for a head


« Reply #7 on: 2012-01-09 09:32:35 »

always a pain
I use the eclipse export thing, which works great - it puts the jars that you need wherever you want, inside the jar or not
then you still have to have a folder with all the lwjgl native files
and do -Djava.library.path=natives_folder
It won't work on all platforms as you can set only a single path....

No idea what you mean - it does work on all platforms. the eclipse export thing takes charge of the external jars I use; while I just say -Djava.library.path=lib.
and in the lib folder (not a jar), there are all the natives for all platforms

I'm assuming he means because LWJGL and Jogl usually have their native libraries in sub-dirs in their distribution for each platform. For LWJGL I always end up unpacking them into a single directory because IIRC none of them share names. I don't know about Jogl though.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline sproingie

JGO Strike Force
***

Posts: 901
Medals: 55



« Reply #8 on: 2012-01-09 11:43:56 »

Aren't the solaris and linux libraries both named liblwjgl.so?
Offline Orangy Tang

JGO Kernel
*****

Posts: 2960
Medals: 37


Monkey for a head


« Reply #9 on: 2012-01-09 11:45:32 »

Might be, but who plays games on Solaris? persecutioncomplex

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Games published by our own members! Go get 'em!
Offline ra4king

JGO Kernel
*****

Posts: 3160
Medals: 196


I'm the King!


« Reply #10 on: 2012-01-09 11:57:48 »

@GustavXIII
That error is not related to LWJGL. It's an FMOD error, maybe you didn't include the FMOD libraries?

Offline GustavXIII

Jr. Member
**

Posts: 57



« Reply #11 on: 2012-01-09 12:04:30 »

@GustavXIII
That error is not related to LWJGL. It's an FMOD error, maybe you didn't include the FMOD libraries?

Yes but why? I include it in the manifest:
lib/NativeFmodEx-win.jar

Am I missing some file? *grr*
Offline ra4king

JGO Kernel
*****

Posts: 3160
Medals: 196


I'm the King!


« Reply #12 on: 2012-01-09 12:14:58 »

Oh are the natives inside the Jar? That doesn't work unless the FMOD library extracts them and loads them itself.

Offline sproingie

JGO Strike Force
***

Posts: 901
Medals: 55



« Reply #13 on: 2012-01-09 12:16:24 »

Might be, but who plays games on Solaris? persecutioncomplex

Nobody on linux does, that's for sure, which means if you unpack all the natives in the same place, you'll have an awful hard time when the solaris libs overwrite the linux ones.
Offline GustavXIII

Jr. Member
**

Posts: 57



« Reply #14 on: 2012-01-09 12:48:00 »

Oh are the natives inside the Jar? That doesn't work unless the FMOD library extracts them and loads them itself.

No I put them in the native directory which you can see on my image ^^
I included it in the maifest:
natives/NativeFmodDesigner.dll
natives/NativeFmodDesigner64.dll
natives/NativeFmodEx.dll
natives/NativeFmodEx64.dll

Maybe I need some other .dll?!?
I cant find another one having this problem *_*
Offline Cero

JGO Neuromancer
****

Posts: 1050
Medals: 18



« Reply #15 on: 2012-01-09 13:37:51 »

Aren't the solaris and linux libraries both named liblwjgl.so?

I obviously dont add the solaris libs. Who cares about Solaris; I might as well start supporting like AmigaOS or OS/2.
Not only are you running Solaris, which I have not met a single person who has ever seen Solaris run, let alone using it, you're also trying to play a game on it... yeah, right.


@FMOD stuff
you have to call Init.loadLibraries();
In case of FMOD I actually add those native jars to the build path in eclipse
so you have the normal jar and then win, win64, linux, linux64 and mac jar - which all include the natives
And you dont need Designer; well if you dont use it that is

Offline BoBear2681

Full Member
**

Posts: 238
Medals: 8



« Reply #16 on: 2012-01-09 13:49:16 »

I use Solaris at work quite frequently.  Never play games on it though.   Tongue
Offline Cero

JGO Neuromancer
****

Posts: 1050
Medals: 18



« Reply #17 on: 2012-01-09 13:55:18 »

I use Solaris at work quite frequently.  Never play games on it though.   Tongue

yeah not a consumer situation

Offline sproingie

JGO Strike Force
***

Posts: 901
Medals: 55



« Reply #18 on: 2012-01-09 14:00:19 »

Despite the name, lwjgl is not just for games.
Offline GustavXIII

Jr. Member
**

Posts: 57



« Reply #19 on: 2012-01-10 03:39:40 »


@FMOD stuff
you have to call Init.loadLibraries();
In case of FMOD I actually add those native jars to the build path in eclipse
so you have the normal jar and then win, win64, linux, linux64 and mac jar - which all include the natives
And you dont need Designer; well if you dont use it that is

Ive done it
1  
2  
3  
4  
5  
 try {
            Init.loadLibraries();
        } catch (InitException ex) {
            Logger.getLogger(MasterDestroyer.class.getName()).log(Level.SEVERE, null, ex);
        }


but still the same error.
I will delete FMOD and try it later -.-"
       
Offline niq

JGO n00b
*

Posts: 6



« Reply #20 on: 2012-01-10 09:56:35 »

Hi!
Is someone using Slick and can make a executable jar?
If I start my game throught netbeans it run 100%.

Now I wanted to make a .jar.
But when I execute my .jar from the dist directory I get an error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path

I found many threads on google but no real solution.
I put the lwjgl.dll in my lib directory an change the VM Path to that but still the error.

Had someone the same problem?



Hi folks,

I have been following this forum as a guest for a while ..
And I would like to join in Smiley

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  Wink)
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  Smiley

Regards
niq

Offline gouessej

JGO Kernel
*****

Posts: 3560
Medals: 30


TUER


« Reply #21 on: 2012-01-10 10:26:12 »

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

Julien Gouesse
Offline GustavXIII

Jr. Member
**

Posts: 57



« Reply #22 on: 2012-01-10 11:46:55 »

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.
Offline niq

JGO n00b
*

Posts: 6



« Reply #23 on: 2012-01-10 14:01:16 »

Hi again

I would like to thank you for your help Smiley

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
Offline GustavXIII

Jr. Member
**

Posts: 57



« Reply #24 on: 2012-01-10 14:07:57 »

Hi again

I would like to thank you for your help Smiley

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...
Offline gouessej

JGO Kernel
*****

Posts: 3560
Medals: 30


TUER


« Reply #25 on: 2012-01-10 14:13:54 »

@gouessej I will try it tomorrow.
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.

Julien Gouesse
Offline niq

JGO n00b
*

Posts: 6



« Reply #26 on: 2012-01-10 14:51:56 »

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

This time I followed this video on "youtube"
http://www.youtube.com/watch?v=5stQZqOAM70

It seems to be working Smiley

Regards
Offline gouessej

JGO Kernel
*****

Posts: 3560
Medals: 30


TUER


« Reply #27 on: 2012-01-10 15:24:38 »

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.

Julien Gouesse
Offline niq

JGO n00b
*

Posts: 6



« Reply #28 on: 2012-01-10 15:58:10 »

@gouessej
Thanks for your advise Smiley
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
Offline gouessej

JGO Kernel
*****

Posts: 3560
Medals: 30


TUER


« Reply #29 on: 2012-01-10 17:01:30 »

@gouessej
Thanks for your advise Smiley

I'll be looking at that next time I have to deploy a program ..
You're welcome. I would like to see your game(s) in the showcase section  Grin Let me know whether you're ready and I will try to help you as much as I can.

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.
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

Julien Gouesse
Pages: [1] 2
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.168 seconds with 19 queries.