Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8323821

Use toast notifications on Windows 11

    XMLWordPrintable

Details

    • x86_64
    • windows_10

    Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 11
      JDK 21.0.1

      A DESCRIPTION OF THE PROBLEM :
      Notification vanishes from Windows 11 notification center after a few seconds no matter what Windows settings are in use.
      With previous version of Windows notifications stuck in the Windows Notification Center forever until cancelled.

      This problem happens on Windows 11 only and not on previous versions of Windows like Win 10.

      The problem happen because Java uses a 25 years old API for notifications (Shell_NotifyIcon API) that does not work anymore on Windows 11.
      That API was meant for Windows 95, not for Windows 11.

      Windows 11 notifications should use the new API (ToastNotification API).
      https://learn.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/toast-notifications-overview & https://learn.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/send-local-toast-desktop-cpp-wrl

      Java 21 is not able to correctly send a Notification to Windows,
      this is a urgent bug to me because OS notifications are very crucial this days and every modern languages supports it.

      Me and others reported this as an issue:
      https://bugs.java.com/bugdatabase/view_bug?bug_id=8310352
      but someone from Oracle closed the issue by saying that this is not a JDK issue but a Microsoft one.

      I wrote to Microsoft and they suggested to use the new notification APIs meant for Windows 11 since the old APIs are unsupported on newer OS.

      If you don't want to consider it as a bug, no problem,
      but Java is not able to send an OS notification to Windows 11 currently.

      I hope that someone will work on it as a feature request.

      Attachments

        Issue Links

          Activity

            People

              aivanov Alexey Ivanov
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: