[英]Java program running in background
I have a simple java program which is just a single piece of code that reads from a database and modifies the contents of the database based on certain conditions. 我有一个简单的java程序,它只是从数据库中读取的一段代码,并根据某些条件修改数据库的内容。 Now, what I want is that this program should start automatically at the startup and silently run in the background unless someone kills it from the task manager. 现在,我想要的是这个程序应该在启动时自动启动并在后台静默运行,除非有人从任务管理器中杀死它。 I have never done something like this before and don't know exactly how to go about it. 我之前从未做过这样的事情,也不知道该如何去做。 Can someone help me out as to how this can be done? 有人可以帮我解决这个问题吗? Thank you.. 谢谢..
Follow the these steps to do the job :(Assuming you are using windows and jre is installed ) 按照以下步骤完成工作:(假设您正在使用Windows和jre安装)
java LOCATION TO THAT CLASS FILE/MyProgram
in that. 现在创建一个bat文件并将java LOCATION TO THAT CLASS FILE/MyProgram
。 There are two problems here 这里有两个问题
How to add this program to the startup 如何将此程序添加到启动
Run the program as a daemon (background process) 将程序作为守护程序运行(后台进程)
Also for windows, you can check this JSL http://www.roeschter.com/ 也适用于Windows,您可以查看此JSL http://www.roeschter.com/
Thanks. 谢谢。
首先创建jar bash,然后将其添加到crontab任务列表中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.