Having trouble getting started with SWING and JME

Hello everyone,

As said in the title I cannot figure out my build errors. I am getting started on a project in which I need to use a JME canvas in a SWING gui.

So naturally I followed this tutorial to get started :


I am new to JME and SWING but played a bit with some JME tutorials available.

Here are my build errors :

java.lang.ClassNotFoundException: jme3test.post.TestRenderToTexture

at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

at java.lang.ClassLoader.loadClass(ClassLoader.java:307)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:169)

at com.mycompany.swingwithjme.TestCanvas.createCanvas(TestCanvas.java:205)

at com.mycompany.swingwithjme.TestCanvas.main(TestCanvas.java:248)

Exception in thread “main” java.lang.NullPointerException

at com.mycompany.swingwithjme.TestCanvas.createCanvas(TestCanvas.java:215)

at com.mycompany.swingwithjme.TestCanvas.main(TestCanvas.java:248)

Could anybody direct me in the right direction ? That would be very helpful. Thanks in advance !!

I think it looks too late to answer this question. However, there might be someone else struggling with that issue just like a few minutes of me :slight_smile: . The issue is that TestCanvas wants to reach “TestRenderToTexture” application. In line 63 you can see that string variable named appClass and its value is “jme3test.post.TestRenderToTexture”. TestCanvas tries to use that TestRenderToTexture app but the problem is that in your project there is, most likely, no class named TestRenderToTexture in the path “jme3test.post.TestRenderToTexture”.

The basic and exact solution for this is :
Open Project Window
Right click and say new project
Choose jME3 in Categories and jME3 Tests in Projects
Create the project
Follow the package path JmeTests -> JME3 Examples -> jme3test -> awt -> TestCanvas.java
Run or Read it