springboot项目jar包运行

springboot项目jar包运行

参考

Linux后台运行java的jar包

步骤

  1. 进入maven项目中,打包项目。 mvn package -Dmaven.test.skip=true
  2. 运行jar。java -jar upload-01-0.0.1-SNAPSHOT.jar
  3. 停止jar。

windows中运行springboot的项目jar包

运行

方法一:java -jar upload-01-0.0.1-SNAPSHOT.jar 前台运行,关闭命令行窗口,进程终止。

方法二:双击jar包。后台运行。

方法一实例

1D:\00\02>java -jar upload-01-0.0.1-SNAPSHOT.jar 2 3 . ____ _ __ _ _ 4 /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ 5( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ 6 \\/ ___)| |_)| | | | | || (_| | ) ) ) ) 7 ' |____| .__|_| |_|_| |_\__, | / / / / 8 =========|_|==============|___/=/_/_/_/ 9 :: Spring Boot :: (v2.2.1.RELEASE)

停止

方法一:关闭命令行窗口。

方法二:杀死进程。netstat -ano | findstr 80 taskkill -pid 27768 -f

方法二实例

1C:\Users\jie>netstat -ano | findstr 80 2 TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 27768 3 TCP 0.0.0.0:8081 0.0.0.0:0 LISTENING 8928 4 5C:\Users\jie>taskkill -pid 27768 -f 6成功: 已终止 PID27768 的进程。

Linux中运行springboot的项目jar包

运行

方法一:java -jar upload-01-0.0.1-SNAPSHOT.jar

前台运行,失去光标。关闭xshell会话,进程终止。

方法二:java -jar upload-01-0.0.1-SNAPSHOT.jar &

后台运行,关闭xshell会话,进程终止,信息被输出到当前会话窗口。

方法三:nohup java -jar upload-01-0.0.1-SNAPSHOT.jar &

nohup java -jar webapp/upload-01-0.0.1-SNAPSHOT.jar > test.log &

后台运行,关闭xshell会话,进程不会终止,信息默认输出到当前目录下 nohup.out。可以重定向输入到指定文件。

1nohup 意思是不挂断运行命令,当账户退出或终端关闭时,程序仍然运行。 2 3当用 nohup 命令执行作业时,缺省情况下该作业的所有输出被重定向到当前目录下nohup.out的文件中,除非另外指定了输出文件。

方法一实例

1[root@frxxCentOS webapp]# rz 2 3[root@frxxCentOS webapp]# ls 4upload-01-0.0.1-SNAPSHOT.jar 5[root@frxxCentOS webapp]# java -jar upload-01-0.0.1-SNAPSHOT.jar 6 . ____ _ __ _ _ 7 /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ 8( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ 9 \\/ ___)| |_)| | | | | || (_| | ) ) ) ) 10 ' |____| .__|_| |_|_| |_\__, | / / / / 11 =========|_|==============|___/=/_/_/_/ 12 :: Spring Boot :: (v2.2.1.RELEASE)

方法二实例

1[root@frxxCentOS webapp]# java -jar upload-01-0.0.1-SNAPSHOT.jar & 2[1] 9714 3[root@frxxCentOS webapp]# 4[root@frxxCentOS webapp]# 5 . ____ _ __ _ _ 6 /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ 7( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ 8 \\/ ___)| |_)| | | | | || (_| | ) ) ) ) 9 ' |____| .__|_| |_|_| |_\__, | / / / / 10 =========|_|==============|___/=/_/_/_/ 11 :: Spring Boot :: (v2.2.1.RELEASE) 12 13[root@frxxCentOS webapp]#

方法三实例

nohup java -jar upload-01-0.0.1-SNAPSHOT.jar &

1[root@frxxCentOS webapp]# nohup java -jar upload-01-0.0.1-SNAPSHOT.jar & 2[2] 10350 3[root@frxxCentOS webapp]# nohup: 忽略输入并把输出追加到"nohup.out" 4[root@frxxCentOS webapp]# ls 5nohup.out upload-01-0.0.1-SNAPSHOT.jar

nohup java -jar webapp/upload-01-0.0.1-SNAPSHOT.jar &

1# 当前目录是/root ,在当前目录下生成nohup文件。 2 3[root@frxxCentOS ~]# nohup java -jar webapp/upload-01-0.0.1-SNAPSHOT.jar & 4[1] 11113 5[root@frxxCentOS ~]# nohup: 忽略输入并把输出追加到"nohup.out" 6[root@frxxCentOS ~]# pwd 7/root 8[root@frxxCentOS ~]# ls 9anaconda-ks.cfg nohup.out q webapp

nohup java -jar webapp/upload-01-0.0.1-SNAPSHOT.jar > test.log &

1[root@frxxCentOS ~]# nohup java -jar webapp/upload-01-0.0.1-SNAPSHOT.jar > test.log & 2[2] 11282 3[root@frxxCentOS ~]# nohup: 忽略输入重定向错误到标准输出端

停止

方法一:关闭xshell会话窗口。

方法二:ctrl+z 释放光标,然后杀死进程。netstat -ntlp | grep 80 kill -9 2460

1^Z 2[1]+ 已停止 java -jar upload-01-0.0.1-SNAPSHOT.jar

ctrl+z 释放光标。

1[root@frxxCentOS webapp]# netstat -ntlp | grep 80 2tcp6 3 0 :::80 :::* LISTEN 2460/java 3[root@frxxCentOS webapp]# kill -9 2460 4[root@frxxCentOS webapp]# netstat -ntlp |grep 80 5[1]+ 已杀死 java -jar upload-01-0.0.1-SNAPSHOT.jar

bugs

1# ctrl+z 释放光标仍然杀不死进程,有一个 tcp6协议的80端口。 2^Z 3[1]+ 已停止 java -jar upload-01-0.0.1-SNAPSHOT.jar 4[root@frxxCentOS webapp]# netstat -ntlp |grep 80 5tcp6 0 0 :::80 :::* LISTEN 9929/java 6[root@frxxCentOS webapp]# java -jar upload-01-0.0.1-SNAPSHOT.jar 7 8 . ____ _ __ _ _ 9 /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ 10( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ 11 \\/ ___)| |_)| | | | | || (_| | ) ) ) ) 12 ' |____| .__|_| |_|_| |_\__, | / / / / 13 =========|_|==============|___/=/_/_/_/ 14 :: Spring Boot :: (v2.2.1.RELEASE) 15 162019-11-17 14:25:41.066 WARN 10113 --- [ main] o.s.boot.StartupInfoLogger : InetAddress.getLocalHost().getHostName() took 10036 milliseconds to respond. Please verify your network configuration. 172019-11-17 14:25:51.085 INFO 10113 --- [ main] c.m.boot.upload01.Upload01Application : Starting Upload01Application v0.0.1-SNAPSHOT on frxxCentOS with PID 10113 (/root/webapp/upload-01-0.0.1-SNAPSHOT.jar started by root in /root/webapp) 182019-11-17 14:25:51.086 INFO 10113 --- [ main] c.m.boot.upload01.Upload01Application : No active profile set, falling back to default profiles: default 192019-11-17 14:25:54.145 INFO 10113 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 80 (http) 202019-11-17 14:25:54.186 INFO 10113 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 212019-11-17 14:25:54.187 INFO 10113 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.27] 222019-11-17 14:25:54.380 INFO 10113 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/mozq] : Initializing Spring embedded WebApplicationContext 232019-11-17 14:25:54.381 INFO 10113 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3176 ms 242019-11-17 14:25:55.794 INFO 10113 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 252019-11-17 14:25:56.210 INFO 10113 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 262019-11-17 14:25:56.236 INFO 10113 --- [ main] ConditionEvaluationReportLoggingListener : 27 28Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 292019-11-17 14:25:56.237 ERROR 10113 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : 30 31*************************** 32APPLICATION FAILED TO START 33*************************** 34 35Description: 36 37Web server failed to start. Port 80 was already in use. 38 39Action: 40 41Identify and stop the process that's listening on port 80 or configure this application to listen on another port. 42 432019-11-17 14:25:56.241 INFO 10113 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' 44[root@frxxCentOS webapp]#
点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

皕杰报表之UUID

​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

2020年前端实用代码段,为你的工作保驾护航

有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )