java -jar mode of operation

java -jar: run the jar package directly

windows way

jar 包 路径 : E: \ MyCloud \ eureka \ target \ eureka-0.0.1-SNAPSHOT.jar

① CMD window

java -jar E:\MyCloud\eureka\target\eureka-0.0.1-SNAPSHOT.jar

That is, cd to the jar package path, execute java -jar

② Start in bat mode

桌面新建Eureka Server.bat文件,写入以下内容,即可双击运行
java -jar E:\MyCloud\eureka\target\eureka-0.0.1-SNAPSHOT.jar

Linux way

① 命令: java -jar xxx.jar

cd to the jar package path:

java -jar eureka-0.0.1-SNAPSHOT.jar
当前CMD窗口被占用,按CTRL + C打断程序运行,或者直接关闭窗口,也是程序退出

Note : Use java -jar xxx.jar directly, the program will stop when you exit or close the shell. The following method can keep the jar running in the background after running.

(1) java -jar xxx.jar &

Description: Add the & symbol at the end, purpose: run in the background

(2)nohup java -jar xxxx.jar & (推荐)

Description: nohup

Purpose: Run commands without hanging up. Can be used with &

Syntax: nohup Command [Arg…] [&]

Regardless of whether the output of the nohup command is redirected to the terminal, the output will be appended to the nohup.out file in the current directory.

If the nohup.out file in the current directory is not writable, the output is redirected to the $HOME/nohup.out file.

If no file can be created or opened for appending, the command specified by the Command parameter cannot be invoked.

Guess you like

Origin blog.csdn.net/baidu_24752135/article/details/108095056