Introduction to the method of running jar packages under LinuxWhen you need to use a Java program developed on Windows to run on Linux, you need to package the Java program into a jar package Upload it to Linux and run it. The following content will introduce several methods of starting jar packages in the background under Linux.
Optimization method one:
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
Optimization method two:
nohup java -jar xxx.jar &
nohup means running the command line without hanging up. When the account exits or closes the terminal, the program still runs
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.
Optimization method three:
nohup java -jar xxx.jar >/usr/local/temp.txt &
> /usr/local/temp.txt means recording all startup log information into the temp.txt file
The above is the detailed content of Teach you how to execute Java jar package in Linux system. For more information, please follow other related articles on the PHP Chinese website!