Not sure if it matters, but my jogamp-fat.jar file has a bit different name ('out of a 7z') than in your command.
When I run slightly altered command it revealed version 2.4 so I suppose it's irrelevant, true?
That's great, your environment is almost the same as mine.
The next step is probably to investigate Julien's suggestion on stackoverflow of checking for unexpected jar files in the load
It's not easy to get a jar listing out of Java, it depends a bit on your IDE.
I'm using Eclipse and the run configurations dialog has a "Show Command Line"
Which gives me
-classpath "E:\Java3D\workspace-1.6\test\bin;C:\Users\pjnz\.m2\repository\org\jogamp\jogl\jogl-all\2.3.2\jogl-all-2.3.2.jar;C:\Users\pjnz\.m2\repository\org\jogamp\gluegen\gluegen-rt\2.3.2\gluegen-rt-2.3.2.jar;C:\Users\pjnz\git\java3d-utils-1.6.0\bin;C:\Users\pjnz\git\java3d-core-1.6.0\bin;C:\Users\pjnz\git\vecmath-1.6.0\bin;E:\Java3D\workspace-1.6\java3d-examples\bin" _testcase.tuval7
so I notice I'm using the maven 2.3.2 version of jogl (just randomly I guess)
I couldn't find a command to list attached jars in Netbeans, but when checking project properties, classpath is listed there. I took a snippet - see attached:
libs.PNG Is this enough to convince you no obsolete versions are taken into account on run time?
When I swap 'fat' jar with the one you gave me a link to, the error in Netbeans changes to:
new_errors.txt Maybe this could give you a clue you need to solve this puzzle?
Since I have Eclipse already installed, I just created a new project there and the code runs, but spews a few warnings:
eclipse_warning.PNG Are these warnings serious (I don't know what reflective access is yet)?
If it's easier to configure it properly in Eclipse and get rid of these warnings, I can switch IDEs to make it work.
The Illegal reflexive access isn't currently a problem, I just it was added originally to Java3D to allow new Pipelines (like JoglPipeline) to be loaded at runtime, like code injection on application servers, and it's 100% useless now, so in a future build I'll just swap it for a simple switch case.
If it's running in Eclipse then I'm still pondering unusual jar loading (sorry to harp on).
Sometimes the extension directory can be trouble could you swap your main call to this and see what it produces?
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "String.split(String)" because "extdir" is null
C:\Users\PC\AppData\Local\NetBeans\Cache\12.4\executor-snippets\run.xml:111: The following error occurred while executing this line:
C:\Users\PC\AppData\Local\NetBeans\Cache\12.4\executor-snippets\run.xml:68: Java returned: 1
BUILD FAILED (total time: 0 seconds)
Had some exams recently, hence the pause in replying.
I found some duplicates (old 2007 version), but after renaming these files/folders error still persists.
To be frank, I prefer moving on with Eclipse, unless you want to dig deeper.
Thanks for your efforts so far.
Maybe the error message did not get resolved, but I have progressed (using Eclipse) with what I'm trying to do thanks to your involvement .
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:
Using a GraphicsConfigTemplate3D results in the same error:
final GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
final GraphicsConfiguration graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(template);
I hope you can help me with this issue, so that I can update our project's JDK.
Thanks in advance.
I added the option --add-opens=java.desktop/sun.awt=ALL-UNNAMED to the VM arguments but the results were the same in both Java3D versions (1.6.2 and 1.7.1)
Also without the option it still runs on Java versions 11 to 14. The warning message is still the same with or without said option for those versions
I think that the code emitting some warnings should be removed anyway, it was there to work around a bug in Java Webstart which was removed a while ago from Java. "<local3>" is null is the expected behaviour as there is no extension mechanism.
I found out the source of the warnings:
They appear as soon as I use the sun.java2d-related system properties e.g.:
Without setting them, there is no warning whatsoever to be seen. No VM arguments are needed.
The greater problem still arises when using a recent java version (e.g. version 17): "<local3>" (java3d version 1.6) or "awtConfig" (java3d version 1.7) are null and so it is not possible to create a Canvas3D at all.
If I understand correctly, there is no extension mechanism since java version 9. Nevertheless the program still runs correctly in for example version 11, so I don't understand your claim. I would expect it to not work at all from version 9 and on...
Anyway, do you have an idea, how java3d could be used with a recent java version? Is it even possible? If not, might it be fixed in a future release of java3d?
I managed to make it work. Yout suggestion of adding --add-opens=java.desktop/sun.awt=ALL-UNNAMED to the VM arguments did indeed solve the problem. It was entirely my mistake trying to understand where to put it in IntelliJ IDEA. Thank you very much and appologize for my mistake.
The only thing that I haven't managed is to get rid of the warning messages when setting the system properties.
Thank you for your feedback. Actually, as you had still the same warnings caused by reflective accesses, it seemed to indicate that the addition of --add-opens didn't have the expected effect. Please can you tell us where you put --add-opens into IntelliJ? The wiki provides some information for other major IDEs including Apache NetBeans and Eclipse.
On the long term, we'll probably have to provide modules with the necessary information at the right place in order to drive "--add-opens" useless but if some internal classes disappear, we'll have to find another solution.
I took a look at the --add-opens VM-options and managed to make all warnings disappear.
It was necessary to add both options:
Maybe more options are needed for other things but they seem to work as intended.
To add them in IntelliJ:
1. Open 'Edit Run/Debug configurations' dialog
2. VM options are hidden by default. To add them press "Alt+V" or select "Modify Options -> Add VM Options"
3. Finally write the necessary VM-options sepparated by a space
And that's it! One can totally use Java3D versions 1.6 and 1.7 with the latest JDK version (I also tested version 18). Thank you very much for your support and your time.
Notice than in JDK version 17, I only needed the option --add-opens java.desktop/sun.awt=ALL-UNNAMED to make it run.
The illegal reflective access warnings that showed up when setting the java2d system properties didn't appear in this version but they did in version 11, so check which ones are needed depending on your target JDK