Bioformat upgrade matlab

Dear all,

I am constantly experiencing the following same issue when I am trying to upgrade the bioformat programmatically from matlab 2018b on a Win10 machine. The path where the bioformat should be installed is on a NAS:

*** A new stable version of Bio-Formats is available ***
*** Downloading... ***Error using bfUpgradeCheck (line 64)
Java exception occurred:

	at loci.formats.UpgradeChecker.install(

Error in InterCal (line 21)

Obviously it works fine if I am downloading myself the bioformat…

Hi @miocikot,

thanks for bringing this issue to our attention. The auto-download logic of the upgrade check logic has not minimally tested for the last years and some sections of it are now in a broken state.

We will review the code and deprecate as necessary. Immediately, could you set the autoDownload option to false in your code? If you rely on the programmatic way to get the latest version of the toolbox, you should be to download which contains the JARs as well as the M files.


Hi @s.besson

ok sure.
somehow the unzip function of Matlab is not working anymore with… Originally I had my own routine for upgrading thought the artifacts/ Then came the unzip issue… then I found out the bfUpgradeCheck which never worked…

thank you for your help!

@miocikot: the unzip issue is slightly concerning. Could you paste a copy of the routine you were using for upgrading ?

Hi @s.besson,

here it is:

[~, installed_version] = bfCheckJavaPath(true);
str = urlread('');
expression = ['"\[DIR\]" \/><\/td><td><a href="\d+.\d+.\d+\/">(?<bf_vers>\d+.\d+.\d+\/)'...
    '</a><\/td><td align="right">(?<bf_date>\d+-\w+-\d+ \d+:\d+  )<\/td>'];
tok = regexp(str,expression,'names');
bf_vers = {tok.bf_vers};
bf_date = {tok.bf_date};
bf_date = deblank(bf_date);
[~,idx] = sort(datenum(bf_date),'descend');
last_vers = bf_vers(idx(1));
last_vers = last_vers{1}(1:end-1);

% upgrader = javaObject('loci.formats.UpgradeChecker')

if strcmp(installed_version,last_vers)
    fprintf(['*** bioformats_package.jar version ' last_vers ' is up-to-date ***\n']);
    choice = questdlg(['Do you want to upgrade from ' installed_version ' to ' last_vers '?'], ...
        'Bioformat upgrade', ...
    switch choice
        case 'Yes'
            hwait = msgbox(['Please wait while downloading and unzipping Bioformat...'],...
                'Bioformat upgrade...');
            unzip(['' last_vers '/artifacts/'],...
                [pwd filesep 'mfiles']);
            h = helpdlg('Please restart MATLAB','');
        case 'No'

@miocikot thanks, now I see what went wrong. Various URLs have been reviewed to use systematically HTTPS and redirect from HTTP to HTTPS on our side including everything under the domain.

Testing the second line of your script locally,

str = urlread(‘’);

it seems that the urlread built-in function does not follow redirects. You should be able to fix your upgrade function either by using the HTTPS from or by switching to webread which handles both variants.


great, thank you for your fast reply.
Any news about the bfUpgradeCheck function?

@miocikot: the UpgradeChecker logic and by extension bfUpgradeCheck logic needs a more serious review. I have created to start acting on this in the upcoming 6.2.0 roadmap.