Replies: 2 comments 2 replies
-
Since this is a Rhino issue, this is related to #732 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Can you provide a complete stacktrace for this? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There are issues when calling Java libraries from Javascript with Java 17.
With Java 17, it fails with an exception similar to this:
java.lang.IllegalAccessException: class org.mozilla.javascript.MemberBox cannot access class sun.java2d.SunGraphics2D (in module java.desktop) because module java.desktop does not export sun.java2d to unnamed module
With Java 11, it works, but results in a warning:
WARNING: Illegal reflective access by org.mozilla.javascript.MemberBox (...) to method sun.java2d.SunGraphics2D.setColor(java.awt.Color)
This is described here:
https://groups.google.com/g/mozilla-rhino/c/jmNIszUpBAE
ckeditor/ckbuilder#34
mozilla/rhino#462
mozilla/rhino#1269
The last one seems to be the most up-to-date.
Note: This seems to be an issue with Rhino and Java's module system.
A possible workaround is to use the following VM argument:
But I think this can only be a short-term workaround.
In our environment, we stumble upon this issue, because in many of our reports, we are accessing a Java barcode library (to be more precise: from IDAutomation) through Javascript. This library needs a
java.awt.BufferedImage
to render the barcode. We want to prepare that image by filling it all white. To do this, we call thesetColor
andfillRect
methods.These methods fail with Java 17.
A code excerpt of our barcode JS function:
You can test this yourself by commenting the lines with
bc
- the funtion will then just a white rect as PNG bytes, you can display it as a dynamic image.Beta Was this translation helpful? Give feedback.
All reactions