xuqisheng / Restart4j

Library for restarting your java application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

  • From Jar
  • From an IDE
  • From a unique packaged form
  • etc...

Requirements, Compatibility

  • Java 8 or higher
  • Works on the 3 major platforms: Windows, MacOS, Linux

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.

  • Document Archiver - Archive all your documents in a consistent way, which enables you to retrieve them later fast and easy.

Used libraries

About

Library for restarting your java application

License:Apache License 2.0


Languages

Language:Java 100.0%