This article mainly shares with you how to run the jar package command in Linux. Let's take a look at the effect first, hoping to help everyone.
Linux The command to run the jar package is as follows:
Method 1:
java -jar shareniu.jar
Features: The current ssh window is locked, you can press CTRL + C to interrupt the program running. Or close the window directly and the program exits
How to prevent the window from locking?
Method 2
#java -jar shareniu.jar &
& means running in the background.
Specific: The current ssh window is not locked, but when the window is closed, the program terminates.
Continue to improve, how to make the program still run when the window is closed?
##Method 3
nohup java -jar shareniu.jar &nohup means running the command without hanging up. When the account is logged out or the terminal is closed, the program is still running.
When the nohup command is used to execute a job, by default all the commands of the job will be executed. Output is redirected to the file nohup.out unless an output file is specified otherwise.
Method 4
Explain >temp.txt
##command >out.file
##command >out.file redirects the command output to the out.file file, that is, the output content is not printed on the screen, but is output to the out.file file.You can view background running tasks through the jobs command
##View the pid of the thread occupied by a certain port
netstat -nlp |grep :9181
Related recommendations:
How to run jar files
How to execute the .jar file in the command line?
How to run the jar package The command line prompts that there is no manifest attribute
The above is the detailed content of How to run jar package command in Linux. For more information, please follow other related articles on the PHP Chinese website!