no lwjgl in java.library.path Error

60 views
Skip to first unread message

Mauro Ianni

unread,
Sep 19, 2013, 7:18:56 AM9/19/13
to pl...@googlegroups.com
Hi to all,
after a couple of month I'm near to the end of my game. I have finished to write code and now I have to create the jar file.
To do this I have followed this instruction:

1.  Go to the root directory of your game.  This should have subdirectories like "html", "core", and "java"
2.  Open the pom.xml file in the java subdirectory
3.  Add this XML code to the <plugins> section of the pom:


     
<!-- Plugin to create a single jar that includes all dependencies -->
     
<plugin>
       
<artifactId>maven-assembly-plugin</artifactId>
        <version>2.2.1</
version>
       
<configuration>
         
<descriptorRefs>
           
<descriptorRef>jar-with-dependencies</descriptorRef>
          </
descriptorRefs>
         
<archive>
           
<manifest>
             
<mainClass>SEE BELOW</mainClass>
            </
manifest>
         
</archive>
        </
configuration>
       
<executions>
         
<execution>
           
<id>make-assembly</id>
            <phase>package</
phase>
           
<goals>
             
<goal>single</goal>
            </
goals>
         
</execution>
        </
executions>
     
</plugin>


4.  Find the .java file in the java/
subdirectory of your game.  It should be something like YourGameNameJava.java .  Replace the "SEE BELOW" text with the fully qualified class name of that class.
5.  Type "mvn package" on the command line in the root directory of your game.
6.  When your game starts, close the window and wait for the package process to finish.
7.  Your game will be in a file named something like java/target/yourgamename-java-1.0-SNAPSHOT-jar-with-dependencies.jar
8.  To start your game, run java -jar <your-jar's-name> or double click on the file.
 
But when I go to execute my game i recive this error:
 
Exception in thread "main" 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:132)
at playn.java.JavaGLContext.viewWasResized(JavaGLContext.java:61)
at playn.core.gl.GLContext.setSize(GLContext.java:97)
at playn.java.JavaGLContext.<init>(JavaGLContext.java:44)
at playn.java.JavaGraphics.<init>(JavaGraphics.java:47)
at playn.java.JavaPlatform.<init>(JavaPlatform.java:125)
at playn.java.JavaPlatform.register(JavaPlatform.java:84)
at bongo.java.ScheletroJava.main(ScheletroJava.java:17)


I have tried this method (https://groups.google.com/forum/?hl=it#!searchin/playn/lwjgl/playn/E2t7gNh4ab0/qrcPfmk2qfgJ) but it seems not works with me.

Do you know how to solve it? Or I have to do something different to create the jar?

thanks to all

Daniel Gerson

unread,
Sep 19, 2013, 8:06:47 AM9/19/13
to pl...@googlegroups.com
I haven't done this, so I can't offer much help, only perhaps some clues where to look.

You wrote that you tried the method in the link... does that mean you added

-Djava.library.path=target/natives

to the command line when you ran the file, something like

java -jar <your-jar's-name> -Djava.library.path=target/natives

and you have to make sure that the lwjgl files actually exist in a directory "target/natives" relative to where you are.
If they don't you'll still have a problem.

If you run the java version via maven from the command line in debug mode you'll see that they get added for you:

Execute:Java13CommandLauncher: Executing 'C:\Program Files\Java\jdk1.7.0_25\jre\
bin\java.exe'
with arguments:
'-Djava.library.path=target/natives'
'-classpath'
'C:\tmp\shader_bug\java\target\test-classes;C:\tmp\shader_bug\java\target\classe
s;C:\tmp\shader_bug\core\target\fresh-core-1.0-SNAPSHOT.jar;C:\Users\Daniel\.m2\
..............................
..............................'

DMG

Mauro Ianni

unread,
Sep 19, 2013, 10:36:43 AM9/19/13
to pl...@googlegroups.com
In the directory there is lwjgl driver and also all the far and drivers that I have put in from the lwjgl site.
In the debug mode I recive the same your message.

Daniel Gerson

unread,
Sep 19, 2013, 10:56:42 AM9/19/13
to pl...@googlegroups.com

In the directory there is lwjgl driver and also all the far and drivers that I have put in from the lwjgl site.
In the debug mode I recive the same your message.

I'd recommend uploading a skeleton project to github with your ammendments. Then it won't be a lot of work for people on the forum to check it out, and it will also mitigate the risk that we'd be talking at cross purposes.

DMG
Reply all
Reply to author
Forward
0 new messages