Skip to content

Migration to 1.5.x

Mordechai Meisels edited this page Nov 10, 2020 · 8 revisions

Migrating to the new archive-based update is easy; use the UpdateOptions::archive builder to pass all options. You should then remember to install the archive:

// This
boolean success = config.update(myKey, myInjectable);

// And this
Path tempDir = Paths.get("update");
boolean success = config.updateTemp(tempDir, myKey, myInjectable);
if(success)
    Update.finalizeUpdate(tempDir);

// Become
Path zip = Paths.get("my-archive.zip"); // you can work with string only too
UpdateResult result = config.update(UpdateOptions.archive(zip)
                                                 .publicKey(myKey)
                                                 .injectable(myInjectable));

if(!Files.exists(zip)) // optionally check if anything was downloaded, or nothing changed
    return;

if(result.getException() == null) // success
    Archive.read(zip).install();

Additionally, if you use a minified runtime image, you'll have to add the jdk.zipfs module. It is a static required module, meaning it will still run without it, but you can't use the new archive based update model without it being present.