When we need to run a Java program developed on Windows on Linux, we need to package the Java program into a jar package and upload it to Linux.
The following are several ways to start jar packages in the background under Linux:
Method 1:
java -jar xxx.jar &
& means running in the background, the ssh window is not locked, but when the window is closed , the program will still exit.
Method 2:
nohup java -jar xxx.jar &
nohup means running the command line without hanging up. When the account exits or closes the terminal, the program will still run.
When a job is executed with the nohup command, all output of the job is redirected to the nohup.out file, unless an output file is otherwise specified.
Method 3:
nohup java -jar xxx.jar >/usr/local/temp.txt &
> /usr/local/temp.txt means recording all startup log information into the temp.txt file.
Recommended tutorial:linux tutorial
The above is the detailed content of How to run jar package in linux system?. For more information, please follow other related articles on the PHP Chinese website!