Hello!
I’m trying to run a template file TestSafeCanvas, but I get errors:
compile-single:
run-single:
java.lang.ClassNotFoundException: jme3test.post.TestRenderToTexture
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at jme3test.awt.TestCanvas.createCanvas(TestCanvas.java:214)
at jme3test.awt.TestCanvas.main(TestCanvas.java:260)
Exception in thread “main” java.lang.NullPointerException: Cannot invoke “com.jme3.app.LegacyApplication.setPauseOnLostFocus(boolean)” because “jme3test.awt.TestCanvas.app” is null
at jme3test.awt.TestCanvas.createCanvas(TestCanvas.java:226)
at jme3test.awt.TestCanvas.main(TestCanvas.java:260)
Java Result: 1
Could we we your source for the (minimal that reproduces the problem) application? Or if this is an example project somewhere then could you link to it
I get these errors both in jMonkeyEngine SDK and in IDEA, experiments in jme3-lwjg do not change the result. And disabling swing is unacceptable for me, since I am interested in the combination with swing, this is the essence of this example
You said you tried the SDK. Did you do it the following way:
File | New Project,
Choose Category: JME3, JME3 Tests
Run project
Choose TestSafeCanvas
For me, this works out of the box.
Edit: Instead running with TestChooser, find TestSafeCanvas in IDE and run it independently (in SDK, right click the file in the projects view and select run.
By the way, I noticed when running via TestChooser it bypasses the main method (which has all the swing stuff) and runs it as a regular JME app (not embedded in JFrame).
I needed to change mainClassName in jme3-examples build.gradle to jme3test.awt.TestSafeCanvas to successfully test the app.
For reference, this is how it should look like. (see the Windows title, it is named “Test”)
This seems to be the case yes. Is it correctly formulated the whole thing? TestChooser assumes that everything that is LegacyApplication is invoked differently, main method it used if this is not the case (in TestSafeCanvas is should always use the main?).