Dansoftowner / Restart4j

Library for restarting your java application
Apache License 2.0
16 stars 2 forks source link
desktop java java-library javafx swing

Restart4j

GitHub last commit GitHub issues GitHub

Library for restarting your JVM application. You will most likely use it for restarting your GUI application programmatically.

It works no matter how your application is running:

Requirements, Compatibility

Installation

Maven example

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
<dependency>
    <groupId>com.github.Dansoftowner</groupId>
    <artifactId>Restart4j</artifactId>
    <version>1.4.7</version>
</dependency>

Gradle example

repositories {
    ...
    maven { url 'https://jitpack.io' }
}
dependencies {
    implementation 'com.github.Dansoftowner:Restart4j:1.4.7'
}

Some code examples

Simple restart

final ApplicationRestart appRestart = ApplicationRestart.builder().build();
appRestart.restartApp();

Restart with more options

final ApplicationRestart appRestart = ApplicationRestart.builder()
        .beforeNewProcessCreated(() -> System.out.println("New process will be created..."))
        .beforeCurrentProcessTerminated(() -> System.out.println("The app will be terminated"))
        .build();
appRestart.restartApp();

Demo applications

Two demo applications can be found in the project:

Running SimpleDemo

Projects using Restart4j

If this library is used by your project, let me know in the Discussions and I will mention that in this section.

Used libraries