DIPlib / diplib

Quantitative Image Analysis in C++, MATLAB and Python
https://diplib.org
Apache License 2.0
222 stars 49 forks source link

Java v7 no longer supported #147

Closed crisluengo closed 5 months ago

crisluengo commented 6 months ago

When deploying on GitHub on a macos-14 runner, we get the following error:

error: Source option 7 is no longer supported. Use 8 or later. error: Target option 7 is no longer supported. Use 8 or later.

This is about the Java version we're using to build DIPjavaio and the Java component of DIPviewer.

@wcaarls Can we just pick a higher Java version, or will we need to rewrite the source files to upgrade?

crisluengo commented 6 months ago

It seems that setting -source 1.8 -target 1.8 works fine, at least for DIPjavaio. https://github.com/DIPlib/diplib/compare/master...customize_java_version (Though Java 1.8 is set to expire soon too.)

But viewslice doesn't work for me any more:

java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.NativeLibrary

This might be related to the Java version I'm running? I've got Amazon Coretto 8 to run MATLAB as required on Apple Silicon.

wcaarls commented 6 months ago

At least PyDIPjavaio works fine with Java 11 SE on Ubuntu 22.04 (not setting any source or target). Does viewslice work with 1.7?

crisluengo commented 6 months ago

I haven’t seen it work on this version of MATLAB yet.

wcaarls commented 6 months ago

Perhaps JNA is not installed? We rely on a system or MATLAB jna.jar, which may not be available in your case. Can you try and download it from https://github.com/java-native-access ?

crisluengo commented 6 months ago

JNA is there. I also updated to the latest release of Coretto 8, then told MATLAB to use Coretto 11, then recompiled Viewer.jar using Coretto 11 instead of the system-default JDK, none of those fixed it.

It might be some configuration issue, but I don't know where to even start looking for those. Googling for the error message leads to comments about executables in the temporary directory, but I couldn't figure out how to configure that for MATLAB.

crisluengo commented 5 months ago

I did make the Java version configurable in 47046b5957a3e70b630241e6124c31e82879daee

I didn't want to always use the latest version supported by the JDK because MATLAB works with specific, older Java runtimes. So for use in DIPimage we need to be able to target whatever Java version MATLAB uses.

I made a new issue for viewslice not working on macOS/aarch64: #151.