A tiny, cross-platform library for automatically launching any application or executable at startup.
Supports Windows, macOS, and Linux.
This library is a direct port of node-auto-launch, written in CoffeeScript.
<!-- Add JitPack repository -->
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<!-- Add the dependency -->
<dependency>
<groupId>com.github.Revxrsal</groupId>
<artifactId>autostart4j</artifactId>
<version>(version)</version>
</dependency>
repositories {
maven { url = "https://jitpack.io" }
}
dependencies {
implementation("com.github.Revxrsal:autostart4j:(version)")
}
repositories {
maven(url = "https://jitpack.io")
}
dependencies {
implementation("com.github.Revxrsal:autostart4j:(version)")
}
AutoLaunch autoLaunch = AutoLaunch.builder()
.appName("Everything")
.appFile(new File("C:/Program Files/Everything/Everything.exe"))
// macOS respects the options '--minimized' and '--hidden'.
.args("--minimized")
// For MacOS: This will use the launch agent instead of AppleScript
.useLaunchAgent()
.build();
// To enable:
autoLaunch.enable();
// To disable:
autoLaunch.disable();
// To toggle:
autoLaunch.toggle();
// Check if it is enabled:
boolean enabled = autoLaunch.isEnabled();