JOGL 2.3.2 fails on Java 17 with errors such as
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 1 at jogamp.opengl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationImpl(WindowsAWTWGLGraphicsConfigurationFactory.java:171)
There is limited info on this, traced to this nasty
chosenGC = Win32SunJDKReflection.graphicsConfigurationGet(device, winConfig.getPixelFormatID());
This relies on reflection on core JDK classes, obviously a no-no from Java 9 onwards, but things appear to have been tightened further more recently?
For non-modular deployments this can be ‘fixed’ with JVM args
--add-exports=java.base/java.lang=ALL-UNNAMED
--add-exports=java.desktop/sun.awt=ALL-UNNAMED
--add-exports=java.desktop/sun.java2d=ALL-UNNAMED
There appears no official fix for this is available, even with latest 2.4.x
During travels I found no official recent JOGL releases on Maven central. There are two choices, use the alternative artifacts like so
implementation("com.metsci.ext.org.jogamp.gluegen:gluegen-rt:2.4.0-rc-20200202")
implementation("com.metsci.ext.org.jogamp.jogl:jogl-all:2.4.0-rc-20200202")
implementation "com.metsci.ext.org.jogamp.gluegen:gluegen-rt:2.4.0-rc-20200202:natives-windows-amd64"
implementation "com.metsci.ext.org.jogamp.jogl:jogl-all:2.4.0-rc-20200202:natives-windows-amd64"
Or use the jzy3d repo
maven { url "https://maven.jzy3d.org/releases/" } dependencies { implementation("com.metsci.ext.org.jogamp.gluegen:gluegen-rt:v2.4.0-rc4") implementation("com.metsci.ext.org.jogamp.jogl:jogl-all:v2.4.0-rc4") implementation "com.metsci.ext.org.jogamp.gluegen:gluegen-rt:2.4.0-rc-20200202:natives-windows-amd64" implementation "com.metsci.ext.org.jogamp.jogl:jogl-all:2.4.0-rc-20200202:natives-windows-amd64" }