Bfmatlab update not working

Hi,

I am having issue with updating bfmatlab in Matlab 2018b on MacOs and Windows.

My script add a dynamic path to bfmatlab using:

addpath(‘External/bfmatlab’);

I have update bfmatlab with the latest version 6.4.0 by replacing the bfmatlab folder with the new version.

However, when I check which version using bfCheckJavaPath(), Matlab still only sees an old version 5.1.1:

[a, b] = bfCheckJavaPath()
a =
logical
1
b =
‘5.1.1’

I experience the same issue on a Windows Server 2016 machine. Puzzingly enough, there I have two accounts: the admin and another account with admin rights. On the admin account, Matlab sees the latest version after update, but on the other account, the same problem as I experience on MacOS occurs, with only an older version of bfmatlab detected.

I have tried a lot, changing all instances of bfmatlab another scripts, updating ImageJ bioformat, checking the java/jar in Matlab folder etc…

I am out of imagination as per what I can possibly do now.

Thank you in advance for your help.

Hi,
I did not have any problems with update of bioformats on Matlab.
Could it be that it is still using an old version of the java library?
Try to add the new jar as:
javaaddpath(path);
where path is location of bioformats_package.jar
The older version may also be in the static section of the java path.

Ilya

Thanks for you suggestion, I have tried that but this does not work for me.

As an update to my own post, I have found a workaround for now, which to put a copy of bioformats_package.jar in my Matlab java/jar/ directory and edit the javaclasspath using: edit([prefdir’/javaclasspath.txt’]); and adding the path to the bioformats_package.jar in the Matlab directory. After restarting Matlab, the version is correctly updated.
However, with this workaround, I cannot rely on my script adding a dynamic path with bfmatlab.
Any suggestion?

Hi @rashdj,

the fact you would need to add the JAR manually to the static path via javaclasspath.txt makes me share @Ilya_Belevich’s concern that an older version of the library is defined on the static path and takes precedence over the dynamic path.

Would it be possible to share the content of the javaclasspath command to list all static and dynamic JARs on your system?

Best,
Sébastien

Hi s.besson,

Yes, I thought about that too, but I cannot find any precedence. Am I missing anything?

javaclasspath.txt (86.9 KB)

You probably have a conflict with Micro-Manager installation.

Agreed with @Ilya_Belevich. From your javaclasspath output, the relevant lines are:

   /Applications/Micro-Manager1.4/plugins/Micro-Manager/ome-xml-5.1.1.jar                                     
   /Applications/Micro-Manager1.4/plugins/Micro-Manager/formats-api-5.1.1.jar                                 
   /Applications/Micro-Manager1.4/plugins/Micro-Manager/formats-common-5.1.1.jar                              

Micro-Manager ships its own copy of some of the Bio-Formats JARs which are unfortunately incompatible with the current version in the Bio-Formats MATLAB tooblox.

Great, thanks a lot, I wouldn’t have known.
How do you suggest to proceed, then?
Can I exclude these jar from the Matlab javaclasspath?

Hi @rashdj,

How do you suggest to proceed, then?

You have to remove Micro-Manager jars from the static path; those are stored in classpath.txt. If you delete the file, the static path becomes as Matlab default.
If you still want to use Micro-Manager you will probably have to add those jar packages to the dynamic java path. In this case, you need to make a script/function file, where you add all those jars paths using javaaddpath function and you run the script/function before using Micro-Manager. Since there are many jars, you can use the attached function (I modified code, used in Fiji to connect their jars) to add all those jars at once (you will have to specify the directory with jars).
Most likely you won’t be able to have them both at the same time.

Best regards,
Ilya
add_java.m (1.1 KB)

1 Like

Thanks a lot, I really appreciate! I will try that!