JMonkey SDK 3.5.2: How to add a library to the project?

How to add an existing library to my project in JMonkeyEngine SDK 3.5.2?

I’m watching this: jMonkeyEngine 3.1 - Getting Started Ep. 1 | Setup, Running, Textures, Materials - YouTube

I do not have Libraries folder in the project tree, so I was finding another way. I did find Tools → Libraries, but it is just a list of libraries and I can’t add a library from there to my project.

I searched JMonkey wiki, and it says:

RMB select your project and select “Properties”.

Select “Libraries” on the left and then press “Add Library”.

Select the library from the list and press OK

But when going to Properties, I do not have Libraries there on the left.

So what am I doing wrong? I want to add standard jme3-test-data library to my project so I can do what the guy did in his video.

since i dont code in SDK, but other IDE, i can only guess that you using new SDK version where Gradle is default template, so if you want add new library you need add it like it is always done in Gradle. (you can read Gradle wiki about more info, but generally you add them in gradle.build files)

Like for example you got initializer here for Gradle template:

“preview build.gradle file” at botton also to see result, if correct, then download and use it.
SDK probably also use same initializer

1 Like

Yeah, this is Gradle project, thanks. I’ll Google about Gradle then. I used Maven when working as a Java programmer though.

Also in my project I don’t have material definitions like the guy in the video. He chose unshaded one and for me when editing my custom material, dropbox is empty. Maybe it has something to do with Gradle as well?

Yeah, this is unfortunately a bug with the SDK and the new Gradle template. The Ant template works better in the SDK in this regard. But I would suggest you to stick with Gradle anyway. Use Ant only if you want to play with the material editor etc. Try out stuff. Gradle I would say is closer to Maven you used too I’d say (at least the dependency control is 1:1).

Gradle and Netbeans are good keywords for Google. There is nothing special there. jME is just a set of libraries. And the SDK is just a set of tools.

2 Likes

Thanks to @peedeeboy, matdefs for gradle projects are fixed in the upcoming version of the SDK, which will (hopefully) be available with 3.6, or shortly thereafter.

2 Likes

you can always have 2 projects like me. One for assets as Ant, and second for code as Gradle, then just in gradle inject assets folder from asset project and done.

Another workaround until the 3.6 SDK is released is to copy the matdefs you need from jmonkeyengine/jme3-core/src/main/resources/Common/MatDefs at master · jMonkeyEngine/jmonkeyengine · GitHub into your Gradle project’s /assets folder.

The SDK will find them in there :+1:

(This is a bit of a wastful workaround, as those matdefs will exist twice in your compiled project, once in the jme3-core library Jar, and again in your compiled assets Jar, but for learning JME its fine - and is what I was doing)

1 Like

Hi guys, I’m trying to google how to add the library in Gradle. I found certain lines and put it to dependencies, so I have it like this:

dependencies {

  // Core JME
  implementation "org.jmonkeyengine:jme3-core:$jmeVer"
  implementation "org.jmonkeyengine:jme3-desktop:$jmeVer"
  implementation "org.jmonkeyengine:jme3-lwjgl3:$jmeVer"

  // Suppress errors / warnings building in SDK
  implementation "org.jmonkeyengine:jme3-jogg:$jmeVer"
  implementation "org.jmonkeyengine:jme3-plugins:$jmeVer"
  
**//https://mvnrepository.com/artifact/org.jmonkeyengine/jme3-testdata**
**implementation group: 'org.jmonkeyengine', name: 'jme3-testdata', version: '3.3.0-beta1'**

  

  // Additional Libraries

  // Assets sub-project
  runtimeOnly project(':assets')
}

But it won’t build, I get this error:

Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find org.jmonkeyengine:jme3-testdata:3.3.0-beta1.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/org/jmonkeyengine/jme3-testdata/3.3.0-beta1/jme3-testdata-3.3.0-beta1.pom
       - https://jcenter.bintray.com/org/jmonkeyengine/jme3-testdata/3.3.0-beta1/jme3-testdata-3.3.0-beta1.pom
       - https://jitpack.io/org/jmonkeyengine/jme3-testdata/3.3.0-beta1/jme3-testdata-3.3.0-beta1.pom

So it can’t find the library. What’s wrong?

I’m sorry I am a noob and my commercial working experience is 6 months in total. That’s why I decided to try and develop a game. :smiley:

Because there is no such version available from those locations. Why don’t you try some other version:
https://mvnrepository.com/artifact/org.jmonkeyengine/jme3-testdata

1 Like