Uploaded image for project: 'IGB'
  1. IGB
  2. IGBF-3331

Investigate com.sun.java.swing.plaf.windows requirement

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      Situation: The IGB bundle is failing to load due to a requirement for com.sun.java.swing.plaf.windows.

      Error:

      - Unable to resolve igb [39](R 39.0): missing requirement [igb [39](R 39.0)] osgi.wiring.package; (osgi.wiring.package=com.sun.java.swing.plaf.windows) Unresolved requirements: [[igb [39](R 39.0)] osgi.wiring.package; (osgi.wiring.package=com.sun.java.swing.plaf.windows)]
      

      Task: Resolve the dependency for the IGB bundle on com.sun.java.swing.plaf.windows

        Attachments

          Issue Links

            Activity

            Hide
            nfreese Nowlan Freese added a comment -

            Stackoverflow - What is a look and feel that is compatible with MAC?
            Stackoverflow - How to handle missing Swing PLAF classes in Java 11?
            openjdk - Minimize WindowsLookAndFeel classes included with Unix JDKs

            So it looks like LAFs are no longer included in the base jdk(?) What is confusing is that the issue is a requirement for com.sun.java.swing.plaf.windows in the igb bundle, but I can't find what is requiring com.sun.java.swing.plaf.windows.

            Show
            nfreese Nowlan Freese added a comment - Stackoverflow - What is a look and feel that is compatible with MAC? Stackoverflow - How to handle missing Swing PLAF classes in Java 11? openjdk - Minimize WindowsLookAndFeel classes included with Unix JDKs So it looks like LAFs are no longer included in the base jdk(?) What is confusing is that the issue is a requirement for com.sun.java.swing.plaf.windows in the igb bundle, but I can't find what is requiring com.sun.java.swing.plaf.windows.
            Hide
            nfreese Nowlan Freese added a comment - - edited
            Show
            nfreese Nowlan Freese added a comment - - edited It looks like IGV was trying to handle the requirement for com.sun.java.swing.plaf.windows: https://github.com/igvteam/igv/blob/7392fc24846ffd6ac70d819c355a2cadca26be4d/scripts/igv.args Stackoverflow: What's the difference between --add-exports and --add-opens in Java 9? openjdk: Inaccessible and unused classes can be removed from java.desktop module This seems very close to what I am seeing: Stackoverflow - https://stackoverflow.com/questions/51555030/swing-issue-on-java-10 .
            Hide
            nfreese Nowlan Freese added a comment - - edited

            ChatGPT

            The error message you're seeing indicates that your application has a dependency on the package com.sun.java.swing.plaf.windows, which is not available in Java 11. This package was part of the Java Runtime Environment (JRE) that was distributed by Oracle until Java 8, but it was removed in later versions.

            To fix this issue, you'll need to update your application to use a different package or library that provides the functionality you need. One possible solution is to switch to the standard Swing look and feel, which is available in Java 11 without any additional dependencies.

            If your application requires a specific look and feel that is not available in Java 11, you may need to find a third-party library that provides a compatible implementation. One such library is the Windows Look and Feel (also known as "Windows L&F"), which is available as part of the open source project called "JTattoo". You can download JTattoo from their website (https://www.jtattoo.net/) and add it to your application's classpath.

            Once you have resolved the dependency issue, you should be able to compile and run your application using Java 11 without any further issues.

            The --add-exports command-line option is used to explicitly export a package in the Java Development Kit (JDK) so that it can be accessed by another module. In this case, the command is specifying that the com.sun.java.swing.plaf.windows package from the java.desktop module should be exported to the jide.common module.

            By default, the com.sun.java.swing.plaf.windows package is not exported by the java.desktop module in Java 9 and later versions. This means that code in other modules, such as the jide.common module, may not be able to access classes or resources in this package.

            The --add-exports option allows you to explicitly grant access to a package that would otherwise be inaccessible. In this case, the option is being used to enable the JIDE Ultimate Suite to access the com.sun.java.swing.plaf.windows package, which contains classes that are used by JIDE's Windows Look and Feel implementation.

            It's worth noting that using --add-exports to access internal JDK packages is generally discouraged, as it can lead to compatibility issues and may break in future JDK versions. Instead, it's recommended to use public APIs and libraries whenever possible. However, in some cases, using --add-exports may be necessary to work around limitations in third-party libraries or to access platform-specific features.

            Show
            nfreese Nowlan Freese added a comment - - edited ChatGPT The error message you're seeing indicates that your application has a dependency on the package com.sun.java.swing.plaf.windows, which is not available in Java 11. This package was part of the Java Runtime Environment (JRE) that was distributed by Oracle until Java 8, but it was removed in later versions. To fix this issue, you'll need to update your application to use a different package or library that provides the functionality you need. One possible solution is to switch to the standard Swing look and feel, which is available in Java 11 without any additional dependencies. If your application requires a specific look and feel that is not available in Java 11, you may need to find a third-party library that provides a compatible implementation. One such library is the Windows Look and Feel (also known as "Windows L&F"), which is available as part of the open source project called "JTattoo". You can download JTattoo from their website ( https://www.jtattoo.net/ ) and add it to your application's classpath. Once you have resolved the dependency issue, you should be able to compile and run your application using Java 11 without any further issues. The --add-exports command-line option is used to explicitly export a package in the Java Development Kit (JDK) so that it can be accessed by another module. In this case, the command is specifying that the com.sun.java.swing.plaf.windows package from the java.desktop module should be exported to the jide.common module. By default, the com.sun.java.swing.plaf.windows package is not exported by the java.desktop module in Java 9 and later versions. This means that code in other modules, such as the jide.common module, may not be able to access classes or resources in this package. The --add-exports option allows you to explicitly grant access to a package that would otherwise be inaccessible. In this case, the option is being used to enable the JIDE Ultimate Suite to access the com.sun.java.swing.plaf.windows package, which contains classes that are used by JIDE's Windows Look and Feel implementation. It's worth noting that using --add-exports to access internal JDK packages is generally discouraged, as it can lead to compatibility issues and may break in future JDK versions. Instead, it's recommended to use public APIs and libraries whenever possible. However, in some cases, using --add-exports may be necessary to work around limitations in third-party libraries or to access platform-specific features.
            Hide
            nfreese Nowlan Freese added a comment - - edited

            Command to check what is in module (Java 11):

            java --describe-module java.desktop
            

            When I run this command on Apple, I get com.apple.laf, javax.swing.plaf, etc., but no windows laf.

            Show
            nfreese Nowlan Freese added a comment - - edited Command to check what is in module (Java 11): java --describe-module java.desktop When I run this command on Apple, I get com.apple.laf, javax.swing.plaf, etc., but no windows laf.
            Hide
            nfreese Nowlan Freese added a comment -

            In Java 11 (possibly 9 and 10 as well) the module system (should be java.desktop) that contains com.sun.* as well as com.apple.laf is considered an internal api and is not exported.

            From this stackoverflow there is a workaround to export java.desktop, but it is not recommended. However, it is what IGV appears to be using to access plaf.windows. However, confusingly, on Apple with Zulu JDK 11 I do not see com.sun.java.swing.plaf.windows in java.desktop (maybe it's only included in the Windows jdk version?).

            --add-exports java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED
            
            Show
            nfreese Nowlan Freese added a comment - In Java 11 (possibly 9 and 10 as well) the module system (should be java.desktop) that contains com.sun.* as well as com.apple.laf is considered an internal api and is not exported. From this stackoverflow there is a workaround to export java.desktop, but it is not recommended. However, it is what IGV appears to be using to access plaf.windows . However, confusingly, on Apple with Zulu JDK 11 I do not see com.sun.java.swing.plaf.windows in java.desktop (maybe it's only included in the Windows jdk version?). --add-exports java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED
            Hide
            nfreese Nowlan Freese added a comment -

            Here are some resources explaining optional imports (for example in the igb pom.xml). Several packages that are now considered internal APIs are listed as optional in the import-package in the pom.xml.

            Atlassian: Marking packages as optional imports
            Slideshare: When is 'optional' really optional?
            Apache Felix: apache-felix-maven-bundle-plugin

            Show
            nfreese Nowlan Freese added a comment - Here are some resources explaining optional imports (for example in the igb pom.xml). Several packages that are now considered internal APIs are listed as optional in the import-package in the pom.xml. Atlassian: Marking packages as optional imports Slideshare: When is 'optional' really optional? Apache Felix: apache-felix-maven-bundle-plugin
            Hide
            nfreese Nowlan Freese added a comment -

            As it is unclear if we can provide jidesoft with the required laf dependencies, we are going to try to remove jidesoft from IGB.

            Closing ticket.

            Show
            nfreese Nowlan Freese added a comment - As it is unclear if we can provide jidesoft with the required laf dependencies, we are going to try to remove jidesoft from IGB. Closing ticket.

              People

              • Assignee:
                karthik Karthik Raveendran
                Reporter:
                nfreese Nowlan Freese
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: