Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failes when using JDK9 #44

Open
chekanov opened this issue Oct 15, 2017 · 4 comments
Open

Failes when using JDK9 #44

chekanov opened this issue Oct 15, 2017 · 4 comments

Comments

@chekanov
Copy link

Here is the problem with this library running on JDK9. This issue was discussed here:
https://stackoverflow.com/questions/46746962/jdk9-problems-failes-running-simple-java-code

Exception in thread "main" java.lang.IllegalArgumentException: org.freehep.graphicsbase.util.export.ExportFileType is not an ImageIO SPI class
   at java.desktop/javax.imageio.spi.ServiceRegistry.checkClassAllowed(ServiceRegistry.java:745)
   at java.desktop/javax.imageio.spi.ServiceRegistry.<init>(ServiceRegistry.java:140)
   at org.freehep.graphicsbase.util.export.ExportFileTypeRegistry.<init>(ExportFileTypeRegistry.java:33)
   at org.freehep.graphicsbase.util.export.ExportFileTypeRegistry.getDefaultInstance(ExportFileTypeRegistry.java:44)
   at org.freehep.graphicsbase.util.export.ExportFileType.getExportFileTypes(ExportFileType.java:180)
   at org.freehep.graphicsbase.util.export.ExportFileType.getExportFileTypes(ExportFileType.java:172)
   at org.freehep.graphicsbase.util.export.ExportDialog.addAllExportFileTypes(ExportDialog.java:64)
   at org.freehep.graphicsbase.util.export.ExportDialog.<init>(ExportDialog.java:130)
   at org.freehep.graphicsbase.util.export.ExportDialog.<init>(ExportDialog.java:90)
   at org.freehep.graphicsbase.util.export.ExportDialog.<init>(ExportDialog.java:82)
   at org.freehep.graphicsio.test.TestingFrame.<init>(TestingFrame.java:56)
   at org.freehep.graphicsio.test.TestApplication.main(TestApplication.java:15)
@visrsoftware
Copy link

Any updates on this issue? I am experiencing similar issue with my project, and wishfully hoping someone may have a fix to share (pull request?)

@qwert2003
Copy link

Have a look at
https://sourceforge.net/p/drawj2d/code/HEAD/tree/trunk/src/org/freehep/
A similar JDK9 related error (not the one mentioned above) has been worked around and several warnings have been fixed.

@hyounesy
Copy link

hyounesy commented Nov 20, 2018

Thanks for the response. However would you please provide more specifics about how the changes may be related to the issue above? Because as I am looking at the the repository, I still see the same problematic calls in ExportFileTypeRegistry.java .

I think this issue is related to this other post and looks like the fix is not trivial as javax.imageio.spi.ServiceRegistry has to be replaced with java.util.ServiceLoader
I tried spending a bit of time, and wasn't successful.

@qwert2003
Copy link

Sorry for the confusion. My comment was actually rather related to the title "fails when using JDK9" than to the specific IllegalArgumentException.

The freehep code in the drawj2d repo compiles (and runs) using JDK9/JDK11, so the link might be useful to others.
https://sourceforge.net/p/drawj2d/code/HEAD/tree/trunk/src/org/freehep/
https://sourceforge.net/p/drawj2d/code/HEAD/tree/trunk/src/META-INF/services/
(Both META-INF/services/javax.imageio.spi.ImageWriterSpi and META-INF/services/org.freehep.graphicsbase.util.export.ExportFileType seem to be required.)

But again, the comment is not directly related to the issue above. The drawj2d project probably just does not call the part of the code that causes the runtime exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants