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 what seemed like a similar question at first, Read byte array into buffered image WITHOUT ImageIO, but my problem is different and the solution there does 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:
- additional dependencies on other/external libraries;
- going back to Java 1.7;
- having to rebuild from source
Working code snippets appreciated.
Aucun commentaire:
Enregistrer un commentaire