Run Java console app as a daemon (background)(将 Java 控制台应用程序作为守护进程运行(后台))
问题描述
我开发了一个 Java 控制台应用程序,当启动时,打开一个控制台窗口并保持在前台,我想在后台启动该应用程序.
I've developed a Java console application that when start, open a console window and remain in foreground, i want to start that application in background .
现在我通过这个命令行启动应用程序:
Now i launch the application by this command line :
java -jar myapp.jar
有没有办法实现这种行为?更改命令行参数就足够了,或者我需要对我的代码进行一些更改?
Is there a way to achieve this behaviour ? It's enough change the command line parameter or i need to do some change on my code ?
推荐答案
答案取决于操作系统.
*nix: <your command> &
Windows: (opens a new console): start <your command>
Windows: (doesn't open a new console): start /b <your command>
这篇关于将 Java 控制台应用程序作为守护进程运行(后台)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:将 Java 控制台应用程序作为守护进程运行(后台)
基础教程推荐
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
