Setting up 3.1 Master Branch in IntelliJ Idea

I originally wrote this post as a question on how to make this work. But, while I was writing the post I figured it out. I am posting this here so anyone else running into the same issue may be saved this fussyness.

I would like to use the newest code from 3.1 for a project I am working on. I know it can be unstable – I’m not concerned with that. I would like to set this up in IntelliJ Idea. With 3.0, I simply downloaded the nightly build from here and then added the necessary JARs to my classpath. With 3.1, the nightly builds have stopped so I need to build it myself from GitHub. To do this, I ran the following commands (on Ubuntu Desktop 14.04.2 LTS x64 if revelvent).

git clone git@github.com:jMonkeyEngine/jmonkeyengine.git
./gradlew build
ant -f ./sdk build-zip

This is documented here.

I then accessed the jar file at /path/to/cloned/repository/sdk/dist/jmonkeyplatform.zip and then added everything under /jmonkeyplatform/jmonkeyplatform/libs/ that isn’t labeled sources or javadoc to my classpath (IntelliJ Idea did, however, add these and mark them as sources and javadocs). When I do this and I attempt to run a program that just extends SimpleApplication with a main method and empty simpleInitApp() the resolution window works correctly but when I actually start the game I get the following error:

Exception in thread "jME3 Main" java.lang.UnsatisfiedLinkError: The required native library 'openal64' was not found in the classpath via 'native/linux/libopenal64.so'. Error message: no openal64 in java.library.path
    at com.jme3.system.NativeLibraryLoader.loadNativeLibrary(NativeLibraryLoader.java:596)
    at com.jme3.system.lwjgl.LwjglContext.loadNatives(LwjglContext.java:171)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:209)
    at java.lang.Thread.run(Thread.java:745)

I checked to ensure that the lwjgl natives were in the classpath. They wearn’t I added three jars called jwjgl-platform-2.9.2-natives-<os-name>.jar for Windows, OSX, and Linux. This then triggered the following error:

Exception in thread "LWJGL Renderer Thread" java.lang.UnsatisfiedLinkError: The required native library 'bulletjme' was not found in the classpath via 'native/windows/x86_64/bulletjme.dll'
	at com.jme3.system.NativeLibraryLoader.loadNativeLibrary(NativeLibraryLoader.java:341)
	at com.jme3.system.lwjgl.LwjglContext.loadNatives(LwjglContext.java:179)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
	at java.lang.Thread.run(Thread.java:745)

I solved this by adding a file called jme3-bullet-native-3.1.0-SNATSHOT.jar This is where my biggest trip-up was since I was looking for something named bullet and there was nothing starting with B in the alphabetical order listing.

What is the correct way to get

three jars called jwjgl-platform-2.9.2-natives-< os-name>.jar

and

jme3-bullet-native-3.1.0-SNATSHOT.jar

I compiled the master branch using gradlew build but I can’t find those jars.

I also had to add jna-4.5.0.jar to get rid of

Exception in thread “main” java.lang.NoClassDefFoundError: com/sun/jna/Pointer

and the legacy lwjgl.jar to get rid of

Exception in thread “main” java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException

Maybe I’ll be able to remove those 2 when I find the jars you are talking about.

Thank you

I think you’re making life a bit difficult for yourself. Gradle solves pretty much all of these dependency issues if you use it. Right now i presume you are straight up adding jars, which means also adding the engine dependencies too, which would normally be pulled automatically by gradle.

Here is a bare-bones gradle setup.

I think he’s trying to build the engine from source.

You compiled the engine this way? What about gradlew dist? Then look in the dist directory?

…or just do:
dir *.jar /s

…and so what comes out.

Can you clarify something for me that Im working on for the wiki?

The gradle “dist” command description says:
Creates a jME3 examples distribution with all jme3 binaries, sources, javadoc and external libraries under ./dist

but there is no source folder created.

Is the an oversight?

When someone want to use the jars in their game, should they use the “libDist” command and then link to the build/lib jars, sources and javadocs?

or should they use the “dist” command and link to the dist/lib jars, javadocs and since source is missing link to the subproject source?

Then the best would be to invoke gradlew -PbuildJavaDoc=true installand specify the engine as dependency in the gradle project (assuming they use gradle), there are actually gradle templates for things like the assets.jar

Maybe the sources you are looking for are included in the jar files?

It was my guess that the OP compiled the engine and just added the jars as a dependency directly, and not through gradle, hence the dependencies weren’t being pulled with them.

No.

True, but JoRouss asked about gradle and I am working on the NetBeans gradle wiki stuff so I tried to use the opportunity to pick pauls brain.

Edit: The JoRouss reply was a year after the original poster had no replies to the question they asked.

1 Like

You are the wiki man :heart:

1 Like

This is a typo.

Should be
lwjgl-platform-2.9.2-natives-< os-name>.jar

This only lives in the subproject node /jme3-lwjgl /Dependencies/Compile for main unless I run the gradle task copyLibs which then copies it to the /build/libDist/lib-ext folder.

Its now version lwjgl-platform-2.9.3-natives-< os-name>.jar

The only place I find any SNAPSHOT jars is in the subproject node of the respected library after gradle task build.

/jme-bullet/build/libs

For wiki purposes, I am trying to use the tasks listed and there looks like there is no singular place as the goto folder as near as I can tell.

The build folder is missing javadocs.
The dist folder is missing sources.
There is nothing I can see that would build a folder structure where everything is gathered in one place for you.

So I guess I should just stay generic about how to add dependencies.

There is one, as I said if you call gradlew install, they will be installed to your local maven repository, which on linux is ~/.m2, and on Windows might be in AppData, or in the User Profile

Structure looks as follows:

/home/marc/.m2/repository/org/jmonkeyengine/jme3-vr/3.2.0-fix_blender_load_hdr-SNAPSHOT:
insgesamt 50436
23552 -rw-rw-r-- 1 marc marc 24113427 Sep 13 22:04 jme3-vr-3.2.0-fix_blender_load_hdr-SNAPSHOT.jar
 3640 -rw-rw-r-- 1 marc marc  3723348 Sep 13 23:21 jme3-vr-3.2.0-fix_blender_load_hdr-SNAPSHOT-javadoc.jar
    4 -rw-rw-r-- 1 marc marc     2775 Sep 13 19:40 jme3-vr-3.2.0-fix_blender_load_hdr-SNAPSHOT.pom
23236 -rw-rw-r-- 1 marc marc 23793309 Sep 13 19:40 jme3-vr-3.2.0-fix_blender_load_hdr-SNAPSHOT-sources.jar
    4 -rw-rw-r-- 1 marc marc      335 Sep 13 23:21 maven-metadata-local.xml

/home/marc/.m2/repository/org/jmonkeyengine/jme3-vr/3.2.0-fixed_NPE_during_saving_matparam-SNAPSHOT:
insgesamt 50432
23552 -rw-rw-r-- 1 marc marc 24113436 Sep 20 00:05 jme3-vr-3.2.0-fixed_NPE_during_saving_matparam-SNAPSHOT.jar
 3636 -rw-rw-r-- 1 marc marc  3721921 Sep 20 00:05 jme3-vr-3.2.0-fixed_NPE_during_saving_matparam-SNAPSHOT-javadoc.jar
    4 -rw-rw-r-- 1 marc marc     2823 Sep 20 00:05 jme3-vr-3.2.0-fixed_NPE_during_saving_matparam-SNAPSHOT.pom
23236 -rw-rw-r-- 1 marc marc 23793309 Sep 20 00:05 jme3-vr-3.2.0-fixed_NPE_during_saving_matparam-SNAPSHOT-sources.jar
    4 -rw-rw-r-- 1 marc marc      347 Sep 20 00:05 maven-metadata-local.xml

/home/marc/.m2/repository/org/jmonkeyengine/jme3-vr/3.2.0-SNAPSHOT:
insgesamt 50436
23552 -rw-rw-r-- 1 marc marc 24113406 Sep 19 14:19 jme3-vr-3.2.0-SNAPSHOT.jar
 3640 -rw-rw-r-- 1 marc marc  3724676 Sep 19 14:19 jme3-vr-3.2.0-SNAPSHOT-javadoc.jar
    4 -rw-rw-r-- 1 marc marc     2691 Sep  9 13:59 jme3-vr-3.2.0-SNAPSHOT.pom
23236 -rw-rw-r-- 1 marc marc 23793309 Sep  9 13:59 jme3-vr-3.2.0-SNAPSHOT-sources.jar
    4 -rw-rw-r-- 1 marc marc      314 Sep 19 14:19 maven-metadata-local.xml

So this means I have 3 custom engine builds in my repo.
Hint: If you have a gradle project, you could use mavenLocal() to pick these up, it’s actually very convenient, no copying of jar’s and all.

Asside from that, have you tried gradlew assemble?

There is no gradle task install in NetBeans on windows. The only way I can see to have one is to create a custom task since there is no command line option that’s obvious.
Tasks are:
assemble
build->build
build->build system
check
clean
components
configure->configureAndroidNDK
configure->configureVersionInfo
copyLibs
createZipDistribution
dependencies
dependencyInsight
dependentComponents
dist
help
init
libDist
merged->mergedJavadoc
merged->mergedSource
model
projects
properties
run
tasks
wrapper

Yes, several times.

I explored in the file view of NetBeans and don’t know just what its assembling. It spams hundreds of lines into the log file, and at end says it was BUILD SUCCESSFUL.

I went through .m2 folder and theres nothing about jmonkeyengine that I can find.

I searched my drive and the only jmonkeyengine anything is located in NetBeans project folder.

The project properties shows zilch inside it. Nothing there.

I think the problem is windows vs Linux or me.

1 Like

To get an idea what Im dealing with you can see the wiki page here,
https://jmonkeyengine.github.io/wiki/jme3/build_jme3_sources_with_netbeans.html

Edit: I think I can use your info on this wiki page,
https://jmonkeyengine.github.io/wiki/jme3/simpleapplication_from_the_commandline.html#installing-the-jme3-framework

Err are you working on the sdk repository? install and/or assemble should be executed on the engine repository (Because configureAndroidNDK sounds like it’s the SDK)

Nope, this is cloned from the jmonkeyengine repository.

Not sure why gradlew install isn’t working for you in the engine. That’s what I always use to make JME (local modifications) available for gradle projects.

The install target is part of the maven plugin. So it should be there.

When you do a NetBeans clone, it opens as a gradle root project with subprojects and only gradle tasks.

Id have to create a maven project and clone fron that project for it to use the maven repo.

Edit: I can open the maven repo from the services tab and there is no jmonkeyengine listed.

Im going to add jmonkeyengine to the local maven repo and see what happens.

Yeah, I don’t know what to tell you about NetBeans bugs. I use the command line:
gradlew install

-Paul

I see that the ‘install’ task for the main project doesn’t show up in the IDE. I suspect this is a limitation of the Gradle Support plugin. However, if you open the sub-projects, you’ll find that each of them has an ‘install’ task. You might try installing the sub-projects you need, one by one.

Or you could (as I have done) install a command-line tool such as MINGW64 on your system. The version I use came with a package of Git tools I downloaded from https://git-scm.com/ I find it useful because the Git/Gradle support in Netbeans 8 is not as powerful as the command line. So when a Unix expert tells me to ‘git push origin’ or ‘git reset --hard’ I don’t have figure out how to perform that via the Netbeans IDE; I just paste onto the command line. Similarly, I can type gradle/gradlew commands in MINGW64, provided I configure the environment first:

export JAVA_HOME="C:\Program Files\jmonkeyplatform-3.1.0\jdk"
1 Like