I have set up a gradle multi project. All subprojects are able to successfully pick the requested jme3 jars from where I pulled/forked jme3 (and built the jars using gradle). However, the application exits and gives the following error :
Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/opengl/GLDebugMessageARBCallback
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:292)
at com.jme3.system.JmeDesktopSystem.newContextLwjgl(JmeDesktopSystem.java:199)
at com.jme3.system.JmeDesktopSystem.newContext(JmeDesktopSystem.java:279)
at com.jme3.system.JmeSystem.newContext(JmeSystem.java:162)
at com.jme3.app.LegacyApplication.start(LegacyApplication.java:461)
at com.jme3.app.LegacyApplication.start(LegacyApplication.java:424)
at com.jme3.app.SimpleApplication.start(SimpleApplication.java:125)
at com.chevreuilgames.retroflashyrpg.noiseviewer.main.NoiseViewer_Main.main(NoiseViewer_Main.java:18)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.opengl.GLDebugMessageARBCallback
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
... 9 more
And I know why : lwjgl3 is used as a dependency correctly, however it fails to use/extract its dlls. To test this out, I tried to use the local bullet-native jar. It didnāt extract its dll but the jar from the jcenter repository did extract a dll.
Now, some of you might say : āWhat tells you that your local jme3 jars are actually used as dependenciesā. My response to this is that, while I was programming my gradle set up, I made a mistake in my groovy code, which made the local jme3 jars not properly linked. What happens then is that all my code breaks. In other words, if my local jme3 jars werenāt actually used, the application couldnāt launch.
My application build.gradle (some parts of it). Sorry for the formatting, I canāt get it right on this forum. :
Do you mean writing the whole path down? I just hate hard coding, especially when in the version.gradle file from jmonkeyengine project there are variables to defines the output name for the jar.
Hereās the output for my executable subproject :
$ ./gradlew.bat :prototype-marchingcubes:dependencies
Full Version: 3.1-stable-custom
POM Version: 3.1.0-stable-custom
NBM Revision: 0
NBM UC Suffix: stable/3.1/plugins
:prototype-marchingcubes:dependencies
------------------------------------------------------------
Project :prototype-marchingcubes
------------------------------------------------------------
apiElements - API elements for main. (n)
No dependencies
archives - Configuration for archive artifacts.
No dependencies
compile - Dependencies for source set 'main' (deprecated, use 'implementation ' instead).
+--- com.sudoplay.joise:joise:1.+ -> 1.1.0
\--- project :prototype-library
\--- com.sudoplay.joise:joise:1.+ -> 1.1.0
compileClasspath - Compile classpath for source set 'main'.
+--- com.sudoplay.joise:joise:1.+ -> 1.1.0
\--- project :prototype-library
\--- com.sudoplay.joise:joise:1.+ -> 1.1.0
compileOnly - Compile only dependencies for source set 'main'.
No dependencies
default - Configuration for default artifacts.
+--- com.sudoplay.joise:joise:1.+ -> 1.1.0
\--- project :prototype-library
\--- com.sudoplay.joise:joise:1.+ -> 1.1.0
implementation - Implementation only dependencies for source set 'main'. (n)
No dependencies
runtime - Runtime dependencies for source set 'main' (deprecated, use 'runtimeOnly ' instead).
+--- com.sudoplay.joise:joise:1.+ -> 1.1.0
\--- project :prototype-library
\--- com.sudoplay.joise:joise:1.+ -> 1.1.0
runtimeClasspath - Runtime classpath of source set 'main'.
+--- com.sudoplay.joise:joise:1.+ -> 1.1.0
\--- project :prototype-library
\--- com.sudoplay.joise:joise:1.+ -> 1.1.0
runtimeElements - Elements of runtime for main. (n)
No dependencies
runtimeOnly - Runtime only dependencies for source set 'main'. (n)
No dependencies
testCompile - Dependencies for source set 'test' (deprecated, use 'testImplementation ' instead).
+--- com.sudoplay.joise:joise:1.+ -> 1.1.0
+--- project :prototype-library
| \--- com.sudoplay.joise:joise:1.+ -> 1.1.0
\--- junit:junit:4.+ -> 4.12
\--- org.hamcrest:hamcrest-core:1.3
testCompileClasspath - Compile classpath for source set 'test'.
+--- com.sudoplay.joise:joise:1.+ -> 1.1.0
+--- project :prototype-library
| \--- com.sudoplay.joise:joise:1.+ -> 1.1.0
\--- junit:junit:4.+ -> 4.12
\--- org.hamcrest:hamcrest-core:1.3
testCompileOnly - Compile only dependencies for source set 'test'.
No dependencies
testImplementation - Implementation only dependencies for source set 'test'. (n)
No dependencies
testRuntime - Runtime dependencies for source set 'test' (deprecated, use 'testRuntimeOnly ' instead).
+--- com.sudoplay.joise:joise:1.+ -> 1.1.0
+--- project :prototype-library
| \--- com.sudoplay.joise:joise:1.+ -> 1.1.0
\--- junit:junit:4.+ -> 4.12
\--- org.hamcrest:hamcrest-core:1.3
testRuntimeClasspath - Runtime classpath of source set 'test'.
+--- com.sudoplay.joise:joise:1.+ -> 1.1.0
+--- project :prototype-library
| \--- com.sudoplay.joise:joise:1.+ -> 1.1.0
\--- junit:junit:4.+ -> 4.12
\--- org.hamcrest:hamcrest-core:1.3
testRuntimeOnly - Runtime only dependencies for source set 'test'. (n)
No dependencies
(*) - dependencies omitted (listed previously)
BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
Wow Iāll definitely use this command again
It seems that Lwgl3 is not actually ācompiledā (more like linked), even jme3-core. However, if I remove the line
compile files(getJmeJar('core'))
Puts everything in red in Intellij because he cannot imports jme3 core.
Thatās the best way to say it actually.
Wow I just didnāt know this was possible. Iāll look into it thank you very much! I confirm that it works. For those who want more information : gradle docs