将 Java 控制台应用程序作为守护进程运行(后台) [英] Run Java console app as a daemon (background)

查看:38
本文介绍了将 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 控制台应用程序作为守护进程运行(后台)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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