如何在EC2实例上使用Tomcat(或其他解决方案)正确部署.jar文件。

huangapple go评论86阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2020年10月2日 06:38:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/64164043.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定