jEdit 5.3pre1 does no longer work with early access releases of JDK9. Last known good is 1.9.0-ea-b52. Since there have been changes to class and resource loading in JDK9, this is most likely going to be a permanent problem and requires changes in jEdit. The most severe problem seems to be with icon loading, especially on the Event Dispatch Thread (EDT), aka "AWT-EventQueue-0". If this takes time to fix properly, could someone please implement some workaround to get jEdit 5.3pre1 up and running again (sans icons)?
Here are some of the exceptions:
10:47:49 [AWT-EventQueue-0] [error] GUIUtilities: Icon not found: 32x32/apps/jedit.png
10:47:49 [AWT-EventQueue-0] [error] GUIUtilities: java.net.MalformedURLException: unknown protocol: jeditresource
10:47:49 [AWT-EventQueue-0] [error] GUIUtilities: at java.net.URL.<init>(URL.java:597)
10:47:49 [AWT-EventQueue-0] [error] GUIUtilities: at java.net.URL.<init>(URL.java:487)
10:47:49 [AWT-EventQueue-0] [error] GUIUtilities: at java.net.URL.<init>(URL.java:436)
10:47:49 [AWT-EventQueue-0] [error] GUIUtilities: at org.gjt.sp.jedit.GUIUtilities.loadIcon(GUIUtilities.java:158)
…
10:47:49 [AWT-EventQueue-0] [error] BeanShellFacade: java.lang.NullPointerException
10:47:49 [AWT-EventQueue-0] [error] BeanShellFacade: at org.gjt.sp.jedit.GUIUtilities.getEditorIcon(GUIUtilities.java:181)
10:47:49 [AWT-EventQueue-0] [error] BeanShellFacade: at org.gjt.sp.jedit.gui.tray.JEditSwingTrayIcon.<init>(JEditSwingTrayIcon.java:60)
…
10:47:50 [main] [error] JARClassLoader: java.net.MalformedURLException: unknown protocol: jeditresource
10:47:50 [main] [error] JARClassLoader: at java.net.URL.<init>(URL.java:597)
10:47:50 [main] [error] JARClassLoader: at java.net.URL.<init>(URL.java:487)
10:47:50 [main] [error] JARClassLoader: at java.net.URL.<init>(URL.java:436)
10:47:50 [main] [error] JARClassLoader: at org.gjt.sp.jedit.JARClassLoader.getResource(JARClassLoader.java:175)
…
10:47:50 [main] [error] String: Unable to access resource: /console/commands/ant.xml
10:47:53 [AWT-EventQueue-0] [error] AWT-EventQueue-0: Exception in thread "AWT-EventQueue-0"
10:47:53 [AWT-EventQueue-0] [error] AWT-EventQueue-0: java.lang.NullPointerException
10:47:53 [AWT-EventQueue-0] [error] AWT-EventQueue-0: at org.gjt.sp.jedit.GUIUtilities.getEditorIcon(GUIUtilities.java:181)
10:47:53 [AWT-EventQueue-0] [error] AWT-EventQueue-0: at org.gjt.sp.jedit.View.<init>(View.java:1336)
10:47:53 [AWT-EventQueue-0] [error] AWT-EventQueue-0: at org.gjt.sp.jedit.jEdit.newView(jEdit.java:2553)
10:47:53 [AWT-EventQueue-0] [error] AWT-EventQueue-0: at org.gjt.sp.jedit.PerspectiveManager$PerspectiveHandler.endElement(PerspectiveManager.java:363)
…
10:47:53 [AWT-EventQueue-0] [error] AWT-EventQueue-0: at org.gjt.sp.util.XMLUtilities.parseXML(XMLUtilities.java:140)
10:47:53 [AWT-EventQueue-0] [error] AWT-EventQueue-0: at org.gjt.sp.jedit.SettingsXML.load(SettingsXML.java:155)
10:47:53 [AWT-EventQueue-0] [error] AWT-EventQueue-0: at org.gjt.sp.jedit.PerspectiveManager.loadPerspective(PerspectiveManager.java:107)
Java 1.9 requires a service provider to register an URL stream handler. See java.net.spi.URLStreamHandlerProvider and bug #8064924 as well as changeset 11480:a4e47f145dda.
The two attached files can be used to add such a provider and make jEdit work with Java 1.9 again. Older versions of Java will continue to work with this change.
Until one of the developers includes this change, you can put the files in their designated places parallel to jedit.jar (see file header) and patch as follows:
javac -cp jedit.jar org/gjt/sp/jedit/proto/jeditresource/Provider.java
jar uvf jedit.jar META-INF org
Last edit: will69 2015-04-10
See attached files…
I am confused about the 2nd attachment, is it really a one-liner?
Could you please submit a proper patch to the jedit patches tracker as a separate ticket to address this issue?
Yes, it is a one-liner. It's just a direct referral mechanism. By putting that one liner (2nd file) into the special META-INF folder, you tell Java where to find the provider (1st file) and the provider supplies an instance of the actual URL stream handler for "jeditresource:". This is probably faster than the old way of searching the URL stream handler among all files on the class path.
I might do a patch. I never did one, though, and it might take some time.
Last edit: will69 2015-05-21
I just installed jdk 9: jdk-9-ea-bin-b64-windows-x64-13_may_2015.tar.gz
and have no problems, was jEdit fixed, or maybe a change was done in JDK 9 ?
Apparently somebody got cold feet and Chris Hegarty put some old code back in, see bug #8075139. Both the new service provider mechanism and the old way of searching through classes work with Java 1.9.0-ea-b64.
Nothing was done to jEdit to fix this issue, so since your newer early access works, I can assume this was an issue that was fixed in JDK and we can close this ticket, unless someone else can reproduce it?
You might still want to use the new service provider mechanism since it eliminates the need to search all classes for the "jeditresource:" URL stream handler and might improve startup time. It will also be compatible with modules, which is why they did the change in the first place. Your call.
I'll test the addition of the META-INF file as an optimization.
URLStreamHandlerProvider is new in java9, so we can't compile it with java7, which is current minimal version.
However, the Provider class you wrote works fine.
We would activate it by adding
to the jar task in
build.xml
so the URLStreamHandlerProvider file is not required.So I mark it as open-remind and tagged with JDK9, for when we move to this version.
Thanks,
Java 9 is EOL and jEdit is running on java 11 now