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.