Search code examples
eclipsemavenlwjglplayn

In PlayN, how can I upgrade to PlayN version 1.3.1 without getting "no lwjgl in java.library.path" error?


Update

The reason I couldn't update properly was I didn't have game's jar file properly installed. That was fixed by first running this on the command line:

mvn install:install-file -DgroupId=com.mygame -DartifactId=mygame-core -Dversion=0.9-beta -Dpackaging=jar -Dfile=/home/klenwell/projects/mygame/playn/mygame/java/target/mygame-java-0.9-beta.jar

Then, in Eclipse, I right-clicked java folder > Maven > Test. This updated all my dependencies including lwjgl.

Otherwise, see thomasbroad's answer.

Original Question

I've consulted the following authorities on this topic and applied their various recommendations:

Part of the problem is I'm not sure whether I should be following the Maven instructions or the Eclipse instructions. I've tried both and everything in between.

I'm working in Ubuntu 12.04 64-bit on Eclipse using Maven. Everything was working fine until I changed the PlayN version in my POM file from 1.2 to 1.3.1 and introduced the lwjgl dependency.

What I would have expected to have worked:

1) Download lwjgl (latest version 2.8.4) and test per lwjgl.org instructions (this was successful)

2) Update the appropriate POM files

2A) Add lwjgl.version as a property to mygame/pom.xml

  <properties>
    <playn.version>1.3.1</playn.version>
    <lwjgl.version>2.8.4</lwjgl.version>
  </properties>

2B) Add lwjgl as a dependency to mygame/mygame-java/pom.xml

  <dependency>
    <groupId>org.lwjgl.lwjgl</groupId>
    <artifactId>lwjgl</artifactId>
    <version>${lwjgl.version}</version>
  </dependency>

3) Right-click mygame-java project in Eclipse > Run As > Run Configurations > Arguments and add either -Djava.library.path=target/natives or -Djava.library.path=/absolute/path/to/my/lwjgl/lib to VM arguments. (I've tried both variations.)

I can see the dependencies listed under my java project folder in Eclipse. And when I follow the lwjgl.org guide for Eclipse, I can see the jar listed under the java project folder. But I still get the error.

After two hours of hair-wrenching frustration, I hope somebody can either point out my fatal oversight or provide explicit instructions that will help me get back to work. Thanks.


Solution

  • I upgraded my project from 1.2 to 1.3 a while ago. I only updated my pom.xml files to refer to the new version of PlayN . I did not manually install lwjgl and neither did I add the lwjgl dependency as that one is implicitly pulled in by PlayN

    Manually apply the diffs found here to your project, to your poms.

    The key part being the piece in the java pom that tells Maven to unpack native dependencies. This part was actually added in the previous diff, so you may want to look there as well.

    Now your IDE will most likely tell you that your project is not up-to-date with your poms, update your project, this should pull in the lwjgl dependency and set it up correctly.