The Linux run Jar Package command is as follows:
Way One:
- 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 do I make the window unlocked?
Way Two
- Java-jar Xxx.jar &
The & Representative runs in the background.
Specific: The current SSH window is not locked, but when the window is closed, the program stops running.
Continue to improve, how to make the window closed when the program is still running?
Mode three
Nohup Java-jar Xxx.jar &
Nohup means not to hang up the Run command, when the account exits or the terminal shuts down, the program still runs
When a job is executed with the nohup command, all output from the job is redirected to the Nohup.out file by default, unless the output file is specified separately.
Mode Four
- Nohup Java-jar Xxx.jar >temp.txt &
Explain the next >temp.txt.
Command >out.file
Command >out.file redirects the command output to the Out.file file, which means that the output is not printed to the screen, but is output to the Out.file file.
The jobs command allows you to view the running tasks in the background
- Jobs
All jobs that are executed in the background are listed, and each job has a number in front of it.
If you want to bring a job back to the foreground control, only the FG + number is required.
- FG 23
To view the PID of a thread occupied by a port
NETSTAT-NLP |grep:9181
Run the JAR package program under Linux with nohup background