https://github.com/dansoftowner/restart4j
Library for restarting your java application
https://github.com/dansoftowner/restart4j
desktop java java-library javafx swing
Last synced: about 1 month ago
JSON representation
Library for restarting your java application
- Host: GitHub
- URL: https://github.com/dansoftowner/restart4j
- Owner: Dansoftowner
- License: apache-2.0
- Created: 2021-02-04T13:29:49.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-05-30T19:42:57.000Z (almost 4 years ago)
- Last Synced: 2025-02-26T17:40:34.379Z (about 2 months ago)
- Topics: desktop, java, java-library, javafx, swing
- Language: Java
- Homepage:
- Size: 1.35 MB
- Stars: 18
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# Restart4j
[](https://jitpack.io/#Dansoftowner/Restart4j)
[](https://github.com/Dansoftowner/Restart4j/commits/master)
[](https://github.com/Dansoftowner/Restart4j/issues)
[](LICENSE)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
```xml
jitpack.io
https://jitpack.io
```
```xml
com.github.Dansoftowner
Restart4j
1.4.7```
#### Gradle example
```groovy
repositories {
...
maven { url 'https://jitpack.io' }
}
``````groovy
dependencies {
implementation 'com.github.Dansoftowner:Restart4j:1.4.7'
}
```### Some code examples
#### Simple restart
```java
final ApplicationRestart appRestart = ApplicationRestart.builder().build();
appRestart.restartApp();
```#### Restart with more options
```java
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:
* [SimpleDemo](src/test/java/com/restart4j/SimpleDemo.java)
* [ComplexDemo](src/test/java/com/restart4j/ComplexDemo.java)
# 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](https://github.com/Document-Archiver/com.sophisticatedapps.archiving.document-archiver) - Archive all your documents in a consistent way, which enables you to retrieve them later fast and easy.
### Used libraries
* [SLF4j](http://www.slf4j.org/) - Simple Logging Facade for java
* [OSHI](https://github.com/oshi/oshi) - Operating System & Hardware information
* [Jetbrains annotations](https://github.com/JetBrains/java-annotations) - Annotations for JVM-based languages