Consider I have a sample JavaFX application which updates its UI with an image read from the application\'s JAR, and does so in a delayed manner (i.e. the image is pain
I'm writing an application that needs to lazy-load image thumbnails on a separate thread. ImageIO.read() was hanging, too. But someone suggested doing
new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
in the main application thread before starting other threads, as this apparently causes AWT to run some initialization code the first time which has to be done in the main thread. That solved the ImageIO.read problem.
But it was also hanging when calling
SwingFXUtils.toFXImage(bufferedImage, null);
so I moved that inside my "Platform.runLater(...)" call so that it would be done on the JavaFX thread, and that worked, though it isn't ideal, since I would like that conversion to happen on the separate thread so the UI will be more responsive. But that conversion happens in memory, so I can live with it.
The above behaviour seems to be a bug in the Mac OS X implementation of Oracle JDK -- the problem shows up only with Java 1.8.0, I was unable to reproduce it against either Java 9.0.4 or 10.0.2.