<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Aptos;
panose-1:2 11 0 4 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:12.0pt;
font-family:"Aptos",sans-serif;
mso-ligatures:standardcontextual;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#467886;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
font-size:12.0pt;
font-family:"Aptos",sans-serif;
mso-ligatures:standardcontextual;
mso-fareast-language:EN-US;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Aptos",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1963415094;
mso-list-type:hybrid;
mso-list-template-ids:-930813486 199294170 134807555 134807557 134807553 134807555 134807557 134807553 134807555 134807557;}
@list l0:level1
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:-;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Aptos",sans-serif;
mso-fareast-font-family:Aptos;
mso-bidi-font-family:"Times New Roman";}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style>
</head>
<body lang="en-DE" link="#467886" vlink="#96607D" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I was recently asked to investigate this issue:
<a href="https://bugs.openjdk.org/browse/JDK-8341294">https://bugs.openjdk.org/browse/JDK-8341294</a><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Let me give a summary of the problem here (copied from newest comment in this ticket):<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#172B4D;background:white"># The problem</span><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#172B4D"><br>
<br>
<span style="background:white">A bugfix (</span></span><a href="https://bugs.openjdk.org/browse/JDK-8185862"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#0052CC;background:white">https://bugs.openjdk.org/browse/JDK-8185862</span></a><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#172B4D;background:white">)
changed the behavior of AWT applications on Windows when no display is available.</span><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#172B4D"><br>
<br>
<span style="background:white">## Status Quo (HEAD, > jdk21)</span><br>
<br>
<span style="background:white">If an AWT application is started on a Windows system that does NOT have a display available it will run into:</span><br>
<br>
<span style="background:white">```</span><br>
<span style="background:white">Exception in thread "main" java.lang.InternalError: Could not update the devices array.</span><br>
<span style="background:white">```</span><br>
<br>
<span style="background:white">Setting `-Djava.awt.headless=false` does not affect this outcome.</span><br>
<br>
<span style="background:white">## Earlier behavior (<= jdk 21)</span><br>
<br>
<span style="background:white">If an AWT application is started on a Windows system that does not have a display available it will just start / continue to run.</span><br>
<br>
<span style="background:white">## Expectations</span><br>
<br>
<span style="background:white">Some JDK users were affected by this change because they run applications in Windows VMs without display.</span><br>
<span style="background:white">They want the old behavior back. Maybe by (ab)using setting the flag `-Djava.awt.headless=false` explicitly on startup.</span><br>
<br>
<span style="background:white">## Observations</span><br>
<br>
<span style="background:white">The often mentioned old behavior may be sufficient to "just run" the application without display, however it is bugged.</span><br>
<span style="background:white">If you actually observe what is drawn to the screen when it reappears (e.g. by reconnecting to a remote host),</span><br>
<span style="background:white">then it can be observed that some UI elements are silently not drawn to the window, e.g. the "label" of a `ProgressMonitor`.</span><br>
<br>
<span style="background:white">## What to do?</span><br>
<br>
<span style="background:white">Since I am neither a Windows user nor a an AWT expert I bring this up here for discussion. My current opinion is that the JVM should not revert to the old behavior. As stated above the old behavior is buggy. That certain old tests/workflows
rely on this buggy behavior does not warrant going back in newer JVM versions in my opinion.</span><br>
<span style="background:white">I know there are all kinds of historically grown software stacks out there but if these tests / workflows really cannot be changed, maybe using a virtual display driver would be a workaround ( see e.g. </span></span><a href="https://github.com/VirtualDrivers/Virtual-Display-Driver"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#0052CC;background:white">https://github.com/VirtualDrivers/Virtual-Display-Driver</span></a><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#172B4D;background:white"> ).</span><span lang="EN-US" style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#172B4D;background:white"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#172B4D;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#172B4D;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#172B4D;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#172B4D;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#172B4D;background:white">I wanted to bring this to the attention of AWT devs. I was in contact with a Windows dev who is affected by this problem and his scenario boils down to this:<o:p></o:p></span></p>
<ul style="margin-top:0cm" type="disc">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="EN-US">They are using AWT components in the backend to draw things to buffered images which are then delivered to customers as PNG.<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="EN-US">They use a framework called BIRT, to create PDFs and Word documents, which in turn uses AWT components.<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="EN-US">They cannot run their program because it runs into exceptions when e.g. creating the window. (in a windows container, without display)<o:p></o:p></span></li></ul>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Since I am neither a Windows nor AWT dev I wanted to ask for your input here. Do you think these scenarios should be supported? If yes how? Because just “reverting” to the old behavior does not seem like a good idea (at
least to me). To my understanding this would mean that silently some things are just not drawn.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks for reading,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">David<o:p></o:p></span></p>
</div>
</body>
</html>