Simple Java GUI via JOptionPane fails to display

Bug description:
Standard, “been there forever” Java GUI display calls such as the ones that are part of the built-in JOptionPane class, such as the following:

JOptionPane.showMessageDialog(null, selections, question, JOptionPane.QUESTION_MESSAGE );

fail to display at all or display inconsistently (e.g., have to force click on a “try again” button in the Output tab to see the GUI display).

Expected vs Current Behavior:
Expected: the JOptionPane GUI to consistently display in the Output tab

Actual: the JOptionPane GUI hardly ever displays unless it is coerced into doing so via the “Try Again” button.

GitHub repo that works in VSCode, Eclipse and IntelliJ, unlike and

Steps to reproduce:

  1. Open up my JOptionPaneExample REPL
  2. Run the REPL
  3. Notice the error in the Output pane

Bug appears at this link:

Screenshot(s)/Screen Recording:

Browser/OS/Device: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Replit Profile:

Some more context on this issue:
While it can be a network problem, for some users it isn’t related (as sometimes it does work for them). For when the network isn’t causing the issue:
The “There was an error connecting to the server” message appears when the repl is booted up, including after any disconnect.
→ The way to get it working is to click Try again, or in some cases refresh, or close and reopen the Output editor tab, while the program is running. (The program needs to be displaying stuff.)
The link on the Diagnosis section is outdated I think as replit no longer uses domain.