When using Java3D (version 1.6) without drawing anything onto the screen or setting anything to visible (for example to render an image into a file), the application will not exit. There simply seems to be no way to close Java3D without System.exiting the whole program.
Already tried to call finish on J3DThread (see https://stackoverflow.com/questions/16470930/is-there-a-way-to-terminate-a-java-application-that-uses-java3d-without-calling ), which does not cause any errors - but also doesn't fix the problem, unfortunately.
The problem can be reproduced simply with the old Java3D offscreen_canvas3D example (using the 1.6 libs and dependencies), by simply removing the call the JFrame.setVisible(true). The application starts, opens some windows (Java3D, I assume) for a short moment and then... does nothing but also doesn't exit.
The thread dump can be found here: http://pastebin.com/AK0gNs7D
The question would be, how to dipose the Java3D components manually to get back to the state the application was in before anything Java3D related was started.
The problem is that the provided thread dump shows no thread created by Java3D except main-SharedResourceRunner, which comes from JOGL. Please try to dispose the Java3D canvas too.
I tried setVisible(false), disable (deprecated) on the Canvas3D (since it has no dispose() method), but that doesn't change anything. There seem to be some potentially helpful sounding static methods, but as they aren't public...
Looking at that thread dump, the only non-daemon threads left are the AWT EventQueue threads, meaning there is some AWT component that hasn't been disposed....maybe fire up jvisualVM and look for leftover AWT windows?
Has a section on this subject, that might be worth looking at
Resolved in 1.7.0
All Java3D threads set to daemon
Note there is a strong possibility that this could have side effects particularly in headless environments.
However a daemon nature is more correct and will allow applications to exit gracefully and when expected.
In testing normal swing operations can cause non-exiting.
JFrame f = new JFrame();
will not exit unless
is called. This is unrelated to Java3D.