Hi,
I tried in jdk 21, 23 and 24 and got this:
java.lang.IllegalAccessException: class org.apache.pdfbox.tools.PrintPDF
cannot access class sun.print.SunAlternateMedia (in module java.desktop)
because module java.desktop does not export sun.print to unnamed module
@6bf256fa
It works in jdk11 but this output appears:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.pdfbox.tools.PrintPDF
(file:...) to constructor
sun.print.SunAlternateMedia(javax.print.attribute.standard.Media)
WARNING: Please consider reporting this to the maintainers of
org.apache.pdfbox.tools.PrintPDF
WARNING: Use --illegal-access=warn to enable warnings of further illegal
reflective access operations
WARNING: All illegal access operations will be denied in a future
release using reflection
It works in jdk8:
Tilman
On 23.04.2025 14:35, Ulf Dittmer wrote:
I think it might. I see the source code for that class in the src.zip file
of my Eclipse Temurin OpenJDK 11 distribution, so presumably it's included
in binary as well.
On Wed, Apr 23, 2025 at 6:56 AM Tilman Hausherr<thaush...@t-online.de>
wrote:
Here is a wild solution for that problem:
https://kbdeveloper.qoppa.com/selecting-both-tray-and-paper-size-when-printing-in-java/
The exact class is sun.print.SunAlternateMedia, but this might not work
in newer JDKs.
Tilman