简体   繁体   中英

Running java jar file as a daemon and specify pid path

I'm running CentOS 6 and I have a jar file I'd like to execute with java and have it run in the background. I plan on executing this command from a script, and I also would like to specify the path at which the pid file is output. How can I do all this?

You can use Java Service(Commons Daemon) from apache. Instead of implementing main , your class to execute must provide method for the service execution ( start , stop , etc.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM