Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Java application at system startup on Windows/Linux/MacOS?

How I can run Java application at system startup on Windows/Linux/MacOS?

Any implementation of JNA/JNI shall be welcome.

like image 753
Rajeev Avatar asked May 09 '11 09:05

Rajeev


People also ask

How do I run a Java program in Windows startup?

Put you program in this directory: %appdata%\Microsoft\Windows\Start Menu\Programs\Startup Everything in there will be executed at startup.

Are JAR files cross platform?

JAR (Java Archive) is a cross-platform file format based on the ZIP format, which can be used in Windows, Mac OSX, Linux, Android OS and more.


2 Answers

Take a look at http://wrapper.tanukisoftware.org. It provides a wrapper for java applications to run under the various operating systems. You can use the community edition.

like image 66
Pierre Avatar answered Oct 27 '22 05:10

Pierre


You can consider your application as a service under linux, and add a script that could start it under /etc/init.d (on most distributions, I think). You'll then have to make the needed links to the runlevel folders, to decide when to run your application. I think you can use chkconfig too

A basic example of script can be found here

I don't have most clues for the other two systems, however.

like image 28
Agemen Avatar answered Oct 27 '22 04:10

Agemen