JDK9 includes modules since jdk-9-ea+111. There is an exception when trying to set X11 WM_CLASS (aka x11.wmclass) to "jedit" on Linux via reflection. Luckily, jEdit still starts. The culprit is the call to setAccessible. As a consequence, X11 window class names will be different with JDK9, as seen by calling xprop | grep WM_CLASS:
JDK8: WM_CLASS(STRING) = "sun-awt-X11-XFramePeer", "jedit"
JDK9: WM_CLASS(STRING) = "org-gjt-sp-jedit-jEdit", "org-gjt-sp-jedit-jEdit"
Setting that value in the first place was requested here. There does not seem to be any other way to set it. Throwing an exception on startup should be avoided.
Since this is an expected behavior on JDK9, the startup exception should be eliminated by inserting
before the call to Log.log (sourceforge.net) or at least the log message should be clarified ("Cannot set X11 WM_CLASS to \"jedit\"").
The exception can be eliminated by adding the following command line option on JDK9:
This breaks the access-control boundaries defined by the module system. See also JDK-8061972.
xprop | grep WM_CLASS then yields:
WM_CLASS(STRING) = "jedit", "jedit"
Thus, the above command line option should be added when running on JDK9.
The syntax has been changed twice. First to
and now (around Java 9-ea+149) to
Now that Java 9 is out, is your last comment still valid? Has anything else changed?
I've looked into this some more, I get this message when starting jEdit with Java 9 (OpenJDK build 9+181):
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.gjt.sp.jedit.jEdit (file:/home/danson/apps/jedit/current/jedit.jar) to field sun.awt.X11.XToolkit.awtAppClassName
WARNING: Please consider reporting this to the maintainers of org.gjt.sp.jedit.jEdit
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
The OpenJDK mailing list suggests adding
Add-Opens: java.desktop/sun.awt
to the jar manifest. Doing so, and adjusting the jEdit code to not call the illegal access eliminates the message above, but then there is this:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.gjt.sp.jedit.gui.BufferSwitcher (file:/home/danson/apps/jedit/current/jedit.jar) to field javax.swing.plaf.basic.BasicComboBoxUI.listBox
WARNING: Please consider reporting this to the maintainers of org.gjt.sp.jedit.gui.BufferSwitcher
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
I'll continue to look into this.
Fixed in revision 24747. The fix checks the java version and does not execute the code that sets the WM_CLASS if Java 9 and adds the "Add-Opens" line to the manifest file. Tested with both Java 8 and 9. I'll open another ticket for the second warning since it's really a separate issue.