I'm using Java 8 (OpenJDK 8, specifically) for a project and I need to read an image from a JPG file. Searching around got me to some similar questions at first (e.g. Read byte array into buffered image WITHOUT ImageIO and Is there a 100% Java alternative to ImageIO for reading JPEG files?), but my problem is different and the solutions there do not meet my requirements.
It turns out that the JPEGImageReader
class is still missing. (See openjdk-8: Missing JPEGImageReader functions in libjavajpeg.so) Although that bug report is for Debian, I'm using Kubuntu 14.10 and it's also affected.
Based on the report's last message, no one seems to be working on this issue at this time...
The code snippet to reproduce this error is:
// ...
BufferedImage img = null;
try {
img = ImageIO.read(new File(filename));
} catch (IOException e) {
throw new RuntimeException(e);
}
// ...
The path to the file is valid and this works normally if I use Java 1.7, but changing to 1.8 causes the following excpetion on ImageIO.read
call:
Caught UnsatisfiedLinkError: com.sun.imageio.plugins.jpeg.JPEGImageReader.initReaderIDs(Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;)
I'd like help working around this problem while avoiding:
Working code snippets appreciated.
EDIT-1: Added point #4 to the list.
EDIT-2: Reworded a portion of the main section and added another reference.
I believe this has now been fixed as of March 17th, 2015 release, as per Matthias Klose's email:
Source: openjdk-8 Source-Version: 8u40-b27-1
We believe that the bug you reported is fixed in the latest version of openjdk-8, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is attached.
Thank you for reporting the bug, which will now be closed. If you have further comments please address them to [email protected], and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software pp. Matthias Klose (supplier of updated openjdk-8 package)
(This message was generated automatically at their request; if you believe that there is a problem with it please contact the archive administrators by mailing [email protected])
Is using the Oracle JDK a possibility?
If so, there is some info here on a ppa you can use with ubuntu.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With