You are not logged in.

#1 2021-04-07 11:05:49

kannalo
Member
Registered: 2021-04-07
Posts: 9

Java exception when displaying jpeg

I'm trying to make some software using java/javafx when trying to display a JPEG I get an exception which says "java.io.IOException: Wrong JPEG library version: library is 80, caller expects 90"

I have tried various different versions of the jdk both the openjdk and the oracle jdk. All of them produce the same exception/output. I am using javaFX via maven.

I cant find much information on this anywhere other than this old forum post here and I dont think it was ever solved https://bbs.archlinux.org/viewtopic.php?id=159996

I think the library causing the issue is libjpeg-turbo but am not sure how to fix this, does anyone have any ideas?

Offline

#2 2021-04-07 11:33:44

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: Java exception when displaying jpeg

Does the error also happen if you use openjfx ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2021-04-07 11:50:44

kannalo
Member
Registered: 2021-04-07
Posts: 9

Re: Java exception when displaying jpeg

Lone_Wolf wrote:

Does the error also happen if you use openjfx ?

I'm using openjfx from maven, I do not want to try and get that lib working by having it installed on the system because it is a complete mess and causes tonnes of issues when trying to package the application

Offline

#4 2021-04-08 09:50:46

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: Java exception when displaying jpeg

I asked you to test with openjfx to verify whether the issue originates in maven javaFX or somewhere else.

Is this an application that is intended to run on multiple distros / cross platform ?

Is the sourcecode available/viewable to the public ?

Last edited by Lone_Wolf (2021-04-08 09:52:27)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#5 2021-04-10 07:28:51

kannalo
Member
Registered: 2021-04-07
Posts: 9

Re: Java exception when displaying jpeg

Lone_Wolf wrote:

I asked you to test with openjfx to verify whether the issue originates in maven javaFX or somewhere else.

Is this an application that is intended to run on multiple distros / cross platform ?

Is the sourcecode available/viewable to the public ?

I tested with local javafx jars by adding them into maven pom file i got the javafx 11 sdk form the javafx website. When running with these I got the same type of exception

POM File: https://pastebin.com/An5ev3Vh

I cannot share the source for this project at the moment but here is source code for another.  You can test the image loading by pressing o on the keyboard.  If opening a png it works fine but not when opening a jpeg, I know theres nothing wrong with this project as I have used this in the past. Although the jar for this project which used to work fine for me is also no longer working. The jar below is not built from the source code below, I changed that a bit so that it will print the image exception and also to get rid of the "Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: ImageView.fitWidth : A bound value cannot be set." exception

JAR FIle: https://github.com/NO-ob/Angel/releases

Edited source: https://z.zz.ht/9Dfm8.zip

Last edited by kannalo (2021-04-10 07:29:51)

Offline

#6 2021-04-10 14:08:45

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 1,096

Re: Java exception when displaying jpeg

kannalo wrote:

java.io.IOException: Wrong JPEG library version: library is 80, caller expects 90

The "80" vs "90" looks like it's a JDK incompatibility, but that could be just coincidence with the JDK8 vs 9+ numbering. If it was a true binary class incompatibility you'd expect major/minor codes: 52 for Java 8 and 53+ for Java 9+.

Post/Inspect the full stack trace, not just the IOException one-liner. Then use javap to inspect the two (or more) .class files involved to get their major/minor codes. If they are a mix between 52 and higher, then that's what's going on. Otherwise, it's not a JDK incompatibility and perhaps a JPEG library numbering scheme that's causing this?

Offline

#7 2021-04-10 15:17:52

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: Java exception when displaying jpeg

Did some checking , testing, searching and may have found the issue.

It's not related to javaFX, but to the jpeg standard itself .

Basically libjpeg-turbo only supports upto jpeg v8 but nothing later[1]

There is an implementation of jpeg 9 maintained by the Independent JPEG Group[2]
Aur has a package for it[3] .

libjpeg-turbo comes under a BSD 3-clause license, while jpeg9 has  a custom license .
Both support windows & linux. libjpeg-turbo does appear to support more OSes [4]  and there are lots of other differences .

Looks like you have some thinking to do about who is your target user group and what jpeg version/ library they are most likely to be using .


[1] https://github.com/libjpeg-turbo/libjpeg-turbo#readme
[2] https://ijg.org/
[3] https://aur.archlinux.org/packages/libjpeg9/
[4] https://libjpeg-turbo.org/Documentation … alBinaries


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#8 2021-04-12 11:21:22

kannalo
Member
Registered: 2021-04-07
Posts: 9

Re: Java exception when displaying jpeg

Thankyou, ill try out the libjpeg9, for now I have just added added some code which stores the image in tmp and converts it to png if the image errors guess ill keep that in as a fallback

Offline

Board footer

Powered by FluxBB