当前位置:   article > 正文

【jar包运行与终止】_停止jar包命令

停止jar包命令

运行jar包

输入java -jar 要运行的jar包.jar

终止运行jar包

分两步:
①查询运行jar的PID,输入如下命令:

C:\Users\Administrator\IdeaProjects\springflutterdemo\target>jps
12916
13764 Jps
14680 RemoteMavenServer36
14748 springflutterdemo-0.0.1-SNAPSHOT.jar
14844 Launcher
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

杀死进程

taskkill /pid 进程的PID编号 -f  -t
  • 1

例子

C:\Users\Administrator\IdeaProjects\springflutterdemo\target>java -jar springflutterdemo-0.0.1-SNAPSHOT.jar

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::               (v2.6.11)

2023-03-16 08:25:41.577  INFO 13440 --- [           main] c.e.s.SpringflutterdemoApplication       : Starting SpringflutterdemoApplication v0.0.1-SNAPSHOT using Java 15 on JieLenovoPC with PID 13440 (C:\Users\Administrator\IdeaProjects\springflutterdemo\target\springflutterdemo-0.0.1-SNAPSHOT.jar started by Administrator in C:\Users\Administrator\IdeaProjects\springflutterdemo\target)
2023-03-16 08:25:41.593  INFO 13440 --- [           main] c.e.s.SpringflutterdemoApplication       : No active profile set, falling back to 1 default profile: "default"
2023-03-16 08:25:42.939  INFO 13440 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8099 (http)
2023-03-16 08:25:42.953  INFO 13440 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-03-16 08:25:42.954  INFO 13440 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.65]
2023-03-16 08:25:43.039  INFO 13440 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-03-16 08:25:43.040  INFO 13440 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1368 ms
Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl' adapter.
Parsed mapper file: 'class path resource [mapper/UserMapper.xml]'
2023-03-16 08:25:43.768  WARN 13440 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.PortInUseException: Port 8099 is already in use
2023-03-16 08:25:43.773  INFO 13440 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2023-03-16 08:25:43.787  INFO 13440 --- [           main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-03-16 08:25:43.810 ERROR 13440 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************
APPLICATION FAILED TO START
***************************

Description:

Web server failed to start. Port 8099 was already in use.

Action:

Identify and stop the process that's listening on port 8099 or configure this application to listen on another port.


C:\Users\Administrator\IdeaProjects\springflutterdemo\target>jps
12916
13764 Jps
14680 RemoteMavenServer36
14748 springflutterdemo-0.0.1-SNAPSHOT.jar
14844 Launcher

C:\Users\Administrator\IdeaProjects\springflutterdemo\target>taskkill /pid 14748 -f  -t
成功: 已终止 PID 14748 (属于 PID 12916 子进程)的进程。

C:\Users\Administrator\IdeaProjects\springflutterdemo\target>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/76404
推荐阅读
相关标签
  

闽ICP备14008679号