07、上传jar包到 Linux 并启动项目
1、上传jar包
sh
[root@xx-blog xx-springboot]# pwd
/root/xx-springboot
[root@xx-blog xx-springboot]# ls
xx-springboot-1.0-SNAPSHOT.jar
2、启动命令
sh
java -jar xx-springboot-1.0-SNAPSHOT.jar
sh
[root@xx-blog xx-springboot]# java -jar xx-springboot-1.0-SNAPSHOT.jar
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.5.0)
2025-07-29T09:19:10.652+08:00 INFO 2423 --- [xx-springboot] [ main] com.xx.Application : Starting Application v1.0-SNAPSHOT using Java 21.0.8 with PID 2423 (/root/xx-springboot/xx-springboot-1.0-SNAPSHOT.jar started by root in /root/xx-springboot)
2025-07-29T09:19:10.656+08:00 INFO 2423 --- [xx-springboot] [ main] com.xx.Application : No active profile set, falling back to 1 default profile: "default"
2025-07-29T09:19:11.961+08:00 INFO 2423 --- [xx-springboot] [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8001 (http)
2025-07-29T09:19:11.978+08:00 INFO 2423 --- [xx-springboot] [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2025-07-29T09:19:11.978+08:00 INFO 2423 --- [xx-springboot] [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.41]
2025-07-29T09:19:12.008+08:00 INFO 2423 --- [xx-springboot] [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2025-07-29T09:19:12.010+08:00 INFO 2423 --- [xx-springboot] [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1224 ms
2025-07-29T09:19:12.491+08:00 INFO 2423 --- [xx-springboot] [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8001 (http) with context path '/'
2025-07-29T09:19:12.511+08:00 INFO 2423 --- [xx-springboot] [ main] com.xx.Application : Started Application in 2.663 seconds (process running for 3.242)