英文:
How to properly deploy .jar file using Tomcat (Or another solution?) on an EC2 instance
问题
我有一个Spring API,我将其打包成一个.jar文件。我想要在我的EC2实例上持续运行它。我已经从aws-extras下载了Tomcat 8.5并放置在实例上,并将jar文件放置在.lib子文件夹中并启动了Tomcat,但我无法查询该API。
我是不是漏掉了某一步骤,或者有没有更好的方法在不使用Tomcat的情况下实现这一点?
当使用java运行API时,它是可以工作的,但我希希望能够让它在服务器上持续运行的解决方案。
英文:
So I have a Spring API which I packaged as a .jar file. I would like to run this perpetually on my EC2 instance. I have downloaded tomcat 8.5 from aws-extras onto my instance and have placed the jar file in the .lib subfolder and started tomcat but I can't query the API.
Am I missing a step or is there a better way to do this without Tomcat?
The API works when run with java, but I would like a solution that has it constantly running on the server.
答案1
得分: 1
以下是您要的翻译内容:
我发现做这个最简单的方法是使用以下命令。
nohup java -jar path/to/jar.jar &
这将确保该 JAR 文件作为后台进程运行。
英文:
The easiest way I found to do this is with the following command.
nohup java -jar path/to/jar.jar &
This ensures the jar will run as a background process.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论