简体   繁体   English

在Azure虚拟机上启动jar文件

[英]Launching jar file on Azure virtual machine

I am developing a java server-like application (though it is not a server itself, more like a bot for social network) and I decided to use Azure virtual machine to deploy the app on. 我正在开发类似Java服务器的应用程序(尽管它本身不是服务器,更像是社交网络的机器人),所以我决定使用Azure虚拟机在其上部署该应用程序。 So I've chosen Ubuntu virtual machine. 因此,我选择了Ubuntu虚拟机。 I successfully uploaded .jar file on server, connected to it with Bash shell for Windows and SSH (as described in manual for Azure). 我在服务器上成功上传了.jar文件,并通过Windows和SSH的Bash shell将其连接到该文件(如Azure手册所述)。 Then I am able to launch my file with java -jar server.jar and it works. 然后,我可以使用java -jar server.jar启动文件,并且可以正常工作。 But the problem is that when I close the shell on my home computer, the app shuts down on the server too. 但是问题是,当我关闭家用计算机上的外壳时,该应用程序也会在服务器上关闭。 So my question is how to launch .jar file in the way where it won't exit once I close SSH session? 因此,我的问题是如何以关闭SSH会话后不会退出的方式启动.jar文件?

使用nohup在后台运行命令:

nohup java -jar server.jar &

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM