Create your own auto-update framework

Overview

update4j-logo

Build Status Apache License Java-9+ Maven Release Gitter

Read the documentation, explore the JavaDoc, or see it in action

Create a framework: design the environment and lifecycle (—bootstrap) to make your own auto-update framework and hack it to the core, or use the built-in default bootstrap.

Screenshots

Headless

Using the default bootstrap, downloads 4 files then launches hello-world.jar. You can see that subsequent runs won't download again.

headless

JavaFX

Using a custom bootstrap implemented to report progress in JavaFX, downloads 4 files then launches hello-world.jar.

javafx

Overview

Update4j is the first auto-update and launcher library designed for Java 9+. Easily host your application files anywhere (even Google Drive, Dropbox, Amazon S3, or Maven Central) and you can synchronize them with all your distributed applications. You can use any protocol you wish to retrieve those files and may be protected under authenticated API.

In update4j you have ultimate control of every process, from startup - update - launch - shutdown, since it's a library (you call the 3rd party code) not a framework (3rd party calls your code outside your control). In addition, every single piece of code is completely updatable; even update4j itself, once a new version is released! (Well, if you properly set up the environment.)

Installation & Usage

You can download or install using Maven:

<dependency>
    <groupId>org.update4j</groupId>
    <artifactId>update4j</artifactId>
    <version>1.5.7</version>
</dependency>

You can use it as a regular dependency, or you may run it as a runnable JAR file.

To run it in the modulepath, use either of:

$ java -p update4j-1.5.7.jar -m org.update4j
$ java -p . -m org.update4j

To run it in the classpath, use either of:

$ java -jar update4j-1.5.7.jar
$ java -cp * org.update4j.Bootstrap

For more information refer to Starting the Application in the wiki.

What's New in 1.5.x — Migration Guide

  • New update model Configuration.update(ArchiveUpdateOptions), using an Archive to store update files, it can then be 'installed' (calling Archive::install). #76
  • Deprecated previous update models, but still available for smooth migration.
  • Improved update return value as UpdateResult. #87
  • Using the DefaultLauncher, not passing default.launcher.main.class will run the command-line arguments as a script. #88
  • ignoreBootConflict no longer required if there are no user modules on the boot module layer.
  • DefaultBootstrap::updateFirst now performs update in parallel while launching the business app. #104
  • Support Elliptic Curve cipher. #89
  • Clamp update handler frac values between 0 and 1. #106

Contributors

License

This project is licensed under the Apache Software License 2.0

Comments
  • Right way to hand over from JavaFX bootstrap to business app

    Right way to hand over from JavaFX bootstrap to business app

    In the example you have this javafx splash screen example where user launches delegate.jar and it downloads updates and launches business app.

    I have build something similar; I have separate Updater app which also functions as installer with javafx gui using update4j-1.2.2.jar, running update logic in different thread and a CustomUpdateHandler updating javafx gui as it goes while showing user info on the currently downloading updates, then after update logic is finished, separate business app in run new jvm and updater does System.exit(0);

    I'm wondering if this is an OK way to do it or should I implement it in an other way? Since the updater logic already does an javafx launch I can no longer use Configuration.launch after that am I rite?

    Also I'm still a bit unclear on what needs to be done if the updater app itself requires updates, since the updaterapp jar will be locked while it is running.

    Runtime run = Runtime.getRuntime(); Process process = run.exec("java -jar BUSINESSAPP.jar"); System.exit(0);

    opened by painos 71
  • Crash in javafx.web native code when loaded dynamically

    Crash in javafx.web native code when loaded dynamically

    Maintainer's Note

    If you bump into this issue, this will happen when javafx.web is dynamically loaded in the business application after config.launch(). This is a bug in the JavaFX web engine; you can track progress here.

    Possible workarounds are:

    • Load javafx.web statically on the JVM bootstrap classloader. You shouldn't load it dynamically via update4j's loading mechanism in config.launch().
    • Load it dynamically, and both the bootstrap and the business apps share the same classloader. You should set DynamicClassLoader as the system classloader, as explained in the wiki. This won't work with modules though.
    • Instead of launching via config.launch() start a new JVM as the launch point.

    Original Post

    As the title says, whenever my business application tries to use a WebView from javafx.web, the application crashes producing a hs_err_pid_xxx.log thread dump file. The javafx-web module is loaded dynamically in the module path by update4j (along with the rest of the javafx modules, which have no issues whatsoever). I know update4j is to blame, since everything works fine if I launch the exact same business application directly. I am running OpenJDK 13.0.1+9 with JavaFX 15-ea+1 on a Mac. Any ideas?

    opened by nemphys 60
  • Custom Authorization header when downloading files

    Custom Authorization header when downloading files

    Hello,

    looking at the code, it looks like update4j expects all files to be downloaded to be publicly available.

    Unfortunately, this is not an option for us. Our files need to be protected using OAuth 2.0 (or OpenID Connect). Because of this I am currently searching for a way to inject a custom "Authrorization" header for update4j to use when downloading any files.

    I have written a little library that can be used (for example as a Service with a ServiceLoader) to retrieve the access token as a String. Update4j then only needs to dynamically load and call the service to retrieve the access token and can then use it as the Authorization header.

    Using this method, update4j would be agnostic about the authentication method to use. What do you think?

    Maybe it can even be abstracted further to allow the inclusion of any custom http headers, not just Authentication.

    opened by ChristianCiach 41
  • Request: Demo application code

    Request: Demo application code

    I would like to try update4j, but the current documentation is not enough to know where to start.

    A demo application + launcher code (like fxlauncher) for each way to use the library would go a long way to drive adoption of this library.

    help wanted good first issue 
    opened by martinm1000 41
  • ClassLoaders not controlled by update4j

    ClassLoaders not controlled by update4j

    We have update4j up and running and everything works nicely beside some classloader issues. Currently these 3pps does not work without some kind of workaround:

    • Spring
    • XStream
    • Koloboke

    Before loading the spring application context, which basically instantiate classes, we have to set the current classloader on the thread like this to workaround NoClassDefs:

    Thread.currentThread().setContextClassLoader(tmpClassLoader);
    

    the tmpClassLoader in the above case is taken from an already loaded class.

    For XStream we have to do something similar, take the classloader from an already loaded class like this:

    XStream xStream = new XStream();
    xStream.setClassLoader(XStreamFactory.class.getClassLoader());
    

    For Koloboke we haven't figured out how to handle it.

    If we look inside the koloboke code we see this:

    private static class DefaultFactoryHolder {
    	private static final HashIntObjMapFactory defaultFactory =
    			ServiceLoader.load(HashIntObjMapFactory.class).iterator().next();
    }
    

    and when we look at JDK 11s ServiceLoader.load method, we see that the classloader is fetched like this:

    @CallerSensitive
    public static <S> ServiceLoader<S> load(Class<S> service) {
    	ClassLoader cl = Thread.currentThread().getContextClassLoader();
    	return new ServiceLoader(Reflection.getCallerClass(), service, cl);
    }
    

    Digger deeper, if the current threads context classloader is null the ServiceLoader will use the system classloader:

    if (cl == null) {
    	cl = ClassLoader.getSystemClassLoader();
    }
    

    All issues essentially have the same problem, getting the context classloader is either null or returns a classloader that is not controlled by update4j.

    There must be a more generic way to do this. Can we configure update4j to make sure all returned classloaders are "valid" in the sense that they are controlled by update4j? Can we force each new thread to have update4js classloader when invoking:

    Thread.currentThread().getContextClassLoader()
    

    We are using update4j 1.44, AdoptOpenJDK 11.0.5 On the boot classpath we have 2 jar files: update4j and our custom boot lib, then we get the rest using the config.

    If we run without update4j (using a common classpath) everythings works.

    opened by persal 38
  • Basic issue of understanding

    Basic issue of understanding

    Hello Mordechaim,

    I am a programming novice (at best) and I've been tasked with implementing automatic updates with update4j. I have no idea on how to make update4j ignore files which are older than the downloaded and installed version of the application. Is there any way to do this?

    question 
    opened by Optimaloptic 25
  • Insufficient write access causes temporary directory to grow endlessly

    Insufficient write access causes temporary directory to grow endlessly

    When the destination directory cannot be written to (read-only or insufficient rights), an error is thrown and the temporary directory isn't cleaned up. Any subsequent update attempt will make it grow.

    Perhaps the temporary directory could be cleaned before any update attempt?

    opened by Frozenlock 25
  • Handling --add-exports & --add-opens, etc

    Handling --add-exports & --add-opens, etc

    Hi, I am just trying to wrap my head around how to get this working and I am stuck at the following:

    My modular JavaFX application requires some --add-exports, --add-opens and --add-reads java runtime parameters to operate properly.

    Since the bootstrap application does not (and, as I understand it, should not) have any of the --add-xxx target modules in the module path when it is executed, I get "unknown module" warnings once I run it and, of course, "cannot access ..." exceptions when the time comes to run the business application and use those overrides.

    Since the whole point is to run the business application on the same process as the bootstrap application and since there is no apparent way to inject --add-xxx directives on a running jvm instance, I am at a dead end.

    Any help would be greatly appreciated.

    opened by nemphys 24
  • getOldFiles takes a long time (too long?)

    getOldFiles takes a long time (too long?)

    Hey :) I have been playing around with the DefaultBootstrap and file deletion. File deletion is working great, but if I am starting the launcher without making any changes to the files, the method "getOldFiles" is called and checks EVERY file that is contained in both the new and old config, if it is the same:

                    if (Files.isSameFile(newFile.getPath(), file.getPath())) {
                        continue outer;
                    }
    

    Is this supposed to happen? It delays the start of my program for about a minute or so. I would argue that only the differences in the old and new config are relevant here

    org.update4j.Configuration.java, line 1644

    opened by Dustinhoefer 22
  • Custom launcher

    Custom launcher

    Hi,

    Previously we used fxlauncher in our javafx application with java 8. Unfortunately fxlauncher can not be used with java 11 so we plan to use your update4j because it is compatible with java 11. I downloaded the demo project and I could run it successfully but I did not find the solution to use custom launcher window. I would like to update our application as I you demonstrated in your JavaFX section of your documentation (Update Splash Screen). How can I implement this behaviour? Can you give me some instructions?

    Thanks and regards, Attila Vincze

    opened by avincze73 21
  • fix

    fix

    Hi I'm doing some changes to update4j for our use.

    We have an guiapplication that is now run as an applet... obviously we are moving away from this. There are about 300 users. They usually say, "it's not working", which will of course generate many unnecessary problem tickets

    I need to show some more info for users when things go wrong. The theory is to show some more output and then show errors in window. The users can then copy the error and send in as an issue.

    Typically get an error that the server is down (we distribute the application from the server as well) so a connect exception will trigger a dialog saying that the server is down and so on

    I did this previously by copying DefaultBootstrap and then wrote some logging to system.err (to catch exceptions). After upgrade your update to 1.4.5, I forked update4j and made some changes directly.

    I also added some testing and related modules for this.

    Anyways, have a look and see if this is something you would consider to merge. This is just a preview so if you find it interesting, let me know and I'll put some more effort into it, for a future possible merge. I can also then incorporate your feedback /sear

    opened by erik-romson 20
Owner
null
Old and archived; More recent development is in https://github.com/Create-Fabric/Create-Refabricated.

NOW ARCHIVED Go here for the continuation of this project. Old README Create Fabric A Fabric port of Create. Create Discord: https://discord.gg/AjRTh6

null 12 Dec 7, 2022
Auto updating launcher for JavaFX Applications

FXLauncher Auto updating launcher for JavaFX Applications. Combined with JavaFX native packaging, you get a native installer with automatic app update

Edvin Syse 694 Dec 27, 2022
A scientific charting library focused on performance optimised real-time data visualisation at 25 Hz update rates for data sets with a few 10 thousand up to 5 million data points.

ChartFx ChartFx is a scientific charting library developed at GSI for FAIR with focus on performance optimised real-time data visualisation at 25 Hz u

GSI CS-CO/ACO 385 Dec 30, 2022
Download, Install, Update

What is it? Getdown (yes, it's the funky stuff) is a system for deploying Java applications to end-user computers, as well as keeping those applicatio

Three Rings 482 Dec 30, 2022
Ini adalah Launcher SAMP untuk android, ini hanya untuk mengganti nama dan kemungkinan di update lanjutnya akan mendukung download client. Bersenang senanglah!!!

SAMP-Launcher-Android Ini adalah Launcher SAMP untuk android, ini hanya untuk mengganti nama dan kemungkinan di update lanjutnya akan mendukung downlo

Kiril 3 Nov 3, 2022
A JavaFX UI framework to create fully customized undecorated windows

CustomStage A JavaFX undecorated stage which can fully be customized Donations If this project is helpful to you and love my work and feel like showin

Oshan Mendis 186 Jan 6, 2023
CSS keyframe animation for JavaFX. Create animations like you would do with CSS.

JFXAnimation CSS keyframe animation for JavaFX. If you are using JFoenix JFXAnimation is included (currently version 1.0.0 only) Requirements JDK 8 an

Marcel Schlegel 49 Dec 28, 2022
DataFX - is a JavaFX frameworks that provides additional features to create MVC based applications in JavaFX by providing routing and a context for CDI.

What you’ve stumbled upon here is a project that intends to make retrieving, massaging, populating, viewing, and editing data in JavaFX UI controls ea

Guigarage 110 Dec 29, 2022
A project that shows the different ways on how to create custom controls in JavaFX

JavaFX Custom Controls This project will show different ways on how to create custom controls in JavaFX. It will cover the following approaches: Resty

Gerrit Grunwald 27 Sep 5, 2022
A maven plugin to include features from jmeter-plugins.org for JMeterPluginsCMD Command Line Tool to create graphs, export csv files from jmeter result files and Filter Result tool.

jmeter-graph-tool-maven-plugin A maven plugin to create graphs using the JMeter Plugins CMDRunner from JMeter result files (*.jtl or *.csv) or using F

Vincent DABURON 6 Nov 3, 2022
A small tools to play with JavaFX Color.derive() function - allows to create custom colors and to save those in color palettes.

DeriveColorsFX This is not a serious application. Its a small tool where I just played with the method Color::deriveColor provided by JavaFX. Also its

Oliver Löffler 11 Oct 9, 2022
An Android library that allows you to easily create applications with slide-in menus.

An Android library that allows you to easily create applications with slide-in menus. You may use it in your Android apps provided that you cite this project and include the license in your app. Thanks!

Jeremy Feinstein 11.1k Jan 4, 2023
Nightmare-text - This is a simple lib that help to create, titles, actionbars, hovers and click actions chat components.

Nightmare text This is a simple lib that help to create, titles, actionbars, hovers and click actions chat components. Setup public final class Testin

Jonathan Narvaez 8 Mar 9, 2022
The goal of this project is to create AssertJ assertions for JavaFX (8).

The goal of this project is to create AssertJ assertions for JavaFX (8).

Manuel Mauky 6 Jul 30, 2021
Lib-Tile is a multi Maven project written in JavaFX and NetBeans IDE 8 and provides the functionalities to use and handle easily Tiles in your JavaFX application.

Lib-Tile Intention Lib-Tile is a multi Maven project written in JavaFX and NetBeans IDE and provides the functionalities to use and handle easily Tile

Peter Rogge 13 Apr 13, 2022
To quickly integrate your applications into the EdgeGallery platform, we provide the toolchain project to help developers quickly modify code and migrate applications to the platform.

Toolchain 工具链 工具链是MEC Developer开发者平台中的一个重要特性,当x86平台的App想要上车ARM平台时,底层的代码不可避免的需要进行修改或重写。 App提供者可以通过MEC Developer开发者平台中集成的工具链进行源代码分析,定位需要修改的源代码并根据指导意见进行修

EdgeGallery 19 Jan 7, 2022
Android Resource Manager application to manage and analysis your app resources with many features like image resize, Color, Dimens and code Analysis

AndroidResourceManager Cross-Platform tools to manage your resources as an Android Developer, AndroidResourceManager - ARM provide five main services

Amr Hesham 26 Nov 16, 2022
Show Geyser's players' skins on your server!

GeyserSkinManager There is currently no config - drop in and it works! Known caveats: Only tested on Paper and Spigot 1.16+. 1.13 might break, but thi

Camotoy 50 Dec 6, 2022
The place to come for pair programming practice problems in your language, designed for new and old developers alike.

Coding Dojo About The Coding Dojo is a project and weekly meetup hosted by Code Connector to offer opportunities for learning, mentoring, and practici

Code Connector 55 Nov 18, 2022