Java 作为 Unix 服务运行 [英] Java running as a Unix service

查看:22
本文介绍了Java 作为 Unix 服务运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 Java 构建了一个小守护进程,我想在 Unix(例如 Debian 5)下将它作为服务运行.我已经读到有可能使用 Java 包装器,但是没有其他更容易实现的选项吗?我不能只使用 Unix 命令,例如 xxx java -jar program.jar 吗?

I have built a little daemon in Java and I would like to run it as a service under Unix (e.g. Debian 5). I have read that there is a possibility of using a Java wrapper, but isn't there any other option which is easier to implement? Can't I just use a Unix command such as xxx java -jar program.jar?

推荐答案

好吧,如果你想在退出 shell 的情况下运行你的 java 程序,下面是最简单的方法:

Well, if you want to run your java program even when you exit out of your shell, the following is the most simple way:

$nohup java -jar program.jar &

这篇关于Java 作为 Unix 服务运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆