<分区>
我希望在服务器上持续运行 Java 应用程序。我有使用 sevlet 的经验,但它们不会持续运行。通过研究,我发现这个问题的常见解决方案是使用第三方计时服务;当我编写自己的复杂计时机制时,我对使用其中之一犹豫不决。
此应用程序需要 24/7 全天候运行;我很困惑为什么人们不经常遇到这个问题 - 我是不是在做一些愚蠢的事情?
<分区>
我希望在服务器上持续运行 Java 应用程序。我有使用 sevlet 的经验,但它们不会持续运行。通过研究,我发现这个问题的常见解决方案是使用第三方计时服务;当我编写自己的复杂计时机制时,我对使用其中之一犹豫不决。
此应用程序需要 24/7 全天候运行;我很困惑为什么人们不经常遇到这个问题 - 我是不是在做一些愚蠢的事情?
最佳答案
问题似乎是“如何让我的程序全天候运行 24/7?”答案是:
1.) 让您的计算机全天候 24/7 运行,让程序运行。
2.) 以每月 5 美元的价格将您的程序放到类似 www.digitalocean.com 的网站上,然后……让程序运行。就像您的计算机一样。
William Falcon已经描述过了,有很多云主机。
要对此进行扩展,您只需将 MyProgramThatRunsForever.jar
复制到远程服务器,然后在后台运行它,诸如此类。它会跑啊跑啊跑,做它该做的事……
如果您提出不同的问题,您会得到更好的答案。一方面,我不知道你为什么要这样做,但我认为这是个好主意。
参见:
The X-Y Problem, as it is sometimes called, is a mental block which leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help. It often goes something like this:
User wants to do X. User doesn't know how to do X, but thinks they can fumble their way to a solution if they can just manage to do Y. User doesn't know how to do Y either. User asks for help with Y. Others try to help user with Y, but are confused because Y seems like a strange problem to want to solve. After much interaction and wasted time, it finally becomes clear that the user really wants help with X, and that Y wasn't even a suitable solution for X.
Xy问题
关于java - 在服务器上不断运行java应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20804043/