Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
There is a class in my project. This class in package javax.swing extends javax.swing.JOptionPane because I want to use some protected methods of JOptionPane.
When the compiler is JDK 8 it works fine. I update the JDK version to 11 then I've got a compile error: Package 'javax.swing' exists in another module: java.desktop.
My IDE is Intellij idea. I opened the Settings--Build,Execution,Deployment--Java Compiler and added an item to 'Override compiler parameters pre-module'. The Module is my project. The compilation options is
--patch-module java.desktop=src -d mypatches/java.desktop/src/java.desktop/javax/swing/Top.java
But it does not work.
My project tree is 'GreatProject/src/javax/swing/Top.java'.
What's the 'src -d' means?
What's the right '--patch-module'?
Starting from Java 9 version, full support for the jigsaw project was added to ensure the project's modularity. This system can cause problems at the compile process if the same names are present in packages.
Please, check this topic about the module patching process to adapt your module for javax.swing package.
Also, you may try to use Reflection API for getting elements from 'JOptionPane' class.
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.