Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to run jar under Linux

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Today, the editor will share with you the relevant knowledge points about how to run jar under Linux. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

Method 1:

Java-jar XXX.jar features: the current ssh window is locked, you can press CTRL + C to interrupt the program to run, or directly close the window, the program exits how to make the window unlocked?

Mode two

Java-jar XXX.jar & & stands for running in the background. Specific: the current ssh window is not locked, but the program stops running when the window closes. Continue to improve, how to keep the program running when the window closes?

Mode 3

Nohup java-jar XXX.jar & nohup means to run the command without hanging up, and when the account exits or the terminal closes, the program is still running when the job is executed with the nohup command, all output from the job is redirected to the nohup.out file by default, unless another output file is specified.

Mode 4

Nohup java-jar XXX.jar > temp.txt & explain > temp.txt command > out.file command > out.file redirects the output of command to the out.file file, that is, the output is not printed to the screen, but to the out.file file.

You can view the background running task jobs through the jobs command, and then all the jobs executed in the background are listed, and each job is preceded by a number.

If you want to transfer a job back to the front desk, all you need is a fg + number. Fg 23 View the pid netstat-nlp of threads occupied by a port | grep: 9181

Method five

Nohup java-jar xxx.jar > / dev/null 2 > & 1 &

The program runs in the background and does not require output.

If you use method 5, how to turn off the jar program after it is executed.

# query the idps-ef of the process first | grep java# and then kill the process according to the id number. Very violent, kill-9 xxx.

For example, the process number of the following dwkafka.jar program is 24994.

And then...

These are all the contents of the article "how to run jar under Linux". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report