A simple library to add Java/Kotlin.JVM apps to the autostart of Windows.
The library is available on and on JCenter.
<dependency>
<groupId>com.github.vatbub</groupId>
<artifactId>javaAutoStart</artifactId>
<version>1.1</version>
</dependency>
If you get some strange JNA exceptions, also add these dependencies:
<dependencies>
...
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.5.0</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>5.5.0</version>
</dependency>
...
</dependencies>
The latest versions of the above dependencies are:
import com.github.vatbub.javaautostart.AutoStartManager;
public class JavaDemo {
private String appId = "com.github.vatbub.demoApp";
public void autoStartDemo(){
AutoStartManager manager = new AutoStartManager(appId);
boolean isInAutoStart = manager.isInAutoStart();
if (!isInAutoStart)
manager.addToAutoStart(/* optional: additional launch arguments */);
manager.removeFromAutoStart();
}
}
import com.github.vatbub.javaautostart.AutoStartManager
private val appId = "com.github.vatbub.demoApp"
fun autoStartDemo() {
val manager = AutoStartManager(appId)
val isInAutoStart = manager.isInAutoStart
if (!isInAutoStart)
manager.addToAutoStart(/* optional: additional launch arguments */)
manager.removeFromAutoStart()
}
This library is licensed under the Apache License v2.
Open the LICENSE.txt
file of this repository for more info.
Contributions are welcome. As always, you can submit an issue, fork and submit PRs.