Login  Register

Re: getAWTgraphicsconfiguration() causes NPE error

Posted by Oskarnaugh on Mar 31, 2022; 10:34am
URL: https://forum.jogamp.org/getAWTgraphicsconfiguration-causes-NPE-error-tp4041439p4041703.html

Hi!
As I was updating our project's JDK version from version 1.8 to a newer one, I came across this very same issue. It happens with java versions 16 and on and I get the following error message:
Cannot invoke "com.jogamp.nativewindow.awt.AWTGraphicsConfiguration.getAWTGraphicsConfiguration()" because "<local3>" is null

With versions 11 to 15 the code runs correctly although showing the following warning message:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by javax.media.j3d.JoglPipeline (file:/.../Java3D/1.6.2/j3dcore.jar) to method sun.awt.AppContext.getAppContext()


I am using Java3D version 1.6.2 and jogamp-fat.jar version 2.4.0-rc-20210111
I have tried with several JDK distributors (OpenJDK, Zulu, etc.) as well as with Java3D versions 1.7.0 and 1.7.1-build-20200222, unfortunately resulting always in the same error.

To reproduce it one just have to try to create a Canvas3D:
new Canvas3D(SimpleUniverse.getPreferredConfiguration());

Using a GraphicsConfigTemplate3D results in the same error:
final GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
final GraphicsConfiguration graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(template);
new Canvas3D(graphicsConfiguration);


I hope you can help me with this issue, so that I can update our project's JDK.
Thanks in advance.