Running Java programs on the back end

Hello everyone, I want to run a Java application as a back-end process It's like Tomcat server For I have developed an application And take a class as the main class from a script file ie(startup.sh)file. In calls startup SH file I'm calling a class This is mainmethodclass In the main method class, I wrote my business logic When I run this application on a Linux server, I use putty to work until the putty window is not closed The putty window is also stopped But I need to run this application even if I close it How can I achieve this

Solution

Nohup will detach the process you are running from the current console and continue it when you shut down the terminal Run something like this

nohup java -jar my.jar &

By default, it passes the output to nohup Out, so if you don't want to, you can try:

nohup java -jar my.jar > /dev/null &
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>