Issues with SwingCanvas Tutorial

I’m working on an app where I need to have a jMonkey canvas in a Swing GUI. There’s a tutorial on doing that in the advanced section, here:

However, I’ve had a LOT of problems with it.

First off, near the top of the tutorial there’s a link to

There’s a lot of short code snippets, but I noticed that none of them are snippets from They refer to a class called SwingCanvasTest which is not listed. I haven’t been able to find a copy anywhere in the documentation, and it doesn’t seem to be a part of the jmetests package either.

I’ve tried running the class alone and it doesn’t work.

It exits with these exceptions:

at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(
at jme3test.awt.TestCanvas.createCanvas(
at jme3test.awt.TestCanvas.main(
Exception in thread "main" java.lang.NullPointerException
at jme3test.awt.TestCanvas.createCanvas(
at jme3test.awt.TestCanvas.main(
Java Result: 1

I did my best to decipher the code, and it's some of the most complicated stuff I've ever seen condensed into such a small program, all written sans-comments. I'm not sure if I should be ashamed for not immediately understanding it, or proud that I was able to figure out at least partly what it does.

The program's failure issue comes from this statement here:

Class<? extends Application> clazz = (Class<? extends Application>) Class.forName(appClass);
app = clazz.newInstance();
}catch (ClassNotFoundException ex){
}catch (InstantiationException ex){
}catch (IllegalAccessException ex){

The value of appClass is ""

Basically, this statement is trying to make a new class reference named clazz and assign the already existing class to it. This doesn't work, because the class doesn't exist. ... Hmm... Aha, well I was able to finally get this darn thing to run by running (and thus compiling) so that it does exist. I suppose it normally 'would' exist just from having compiled and run the whole test program, but that won't compile since the last update I got on the SDK.

Still, the other issues continue to be a bother. I'm having a hard time figuring out what everything does, when the tutorial seems to be working from a different example.

If anybody could help to simplify or clarify the tutorial I'd appreciate it. In the mean time, I'll continue working on it and I'll post my notes here.