In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Most people do not understand the knowledge points of this article "how to use bat to start a springboot project", so the editor summarizes the following, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use bat to start a springboot project" article.
1.springboot Project Packaging jar
After packaging, go to the following directory:
The jar file of the springboot packaged here is called api-0.0.1-SNAPSHOT.jar
two。 Write bat to start springboot script
Create a new start.bat file. The contents of the start.bat file are as follows:
Cd% ~ dp0
C:\ jdk\ jdk1.8.0_181\ bin\ java.exe-Dfile.encoding=utf-8-jar api-0.0.1-SNAPSHOT.jar-- server.port=81
Cd% ~ dp0 means to switch to the same directory as bat
-Dfile.encoding=utf-8 setting encoding
-- server.port=81 sets the springboot access port to 81
3.bat starts springboot
Suppose the api-0.0.1-SNAPSHOT.jar and start.bat files are placed in the d:\ apidemo directory
Double-click the start.bat file and the console will pop up automatically. The message is roughly as follows:
D:\ apidemo > cd D:\ apidemo\
D:\ apidemo > C:\ jdk\ jdk1.8.0_181\ bin\ java.exe-Dfile.encoding=utf-8-jar api-0.0.
1-SNAPSHOT.jar-server.port=81
. _ _ _
/ _ _
(()\ _ |'_ |'_ | |'_\ / _ `|\
\ / _) | | _) | | (_ | |)
'| _ |. _ _ | _ | | _ | _ | | _, | /
= | _ | = | _ _ / /
:: Spring Boot:: (v2.4.3)
2021-06-19 16 INFO 2814 33.392 INFO 4436-[main] com.demo.api.ApiApp
Lication: Starting ApiApplication v0.0.1-SNAPSHOT using Java 1.8.0_181
On iZ23lkhhnpiZ with PID 4436 (D:\ apidemo\ api-0.0.1-SNAPSHOT.jar started by Ad
Ministrator in D:\ apidemo)
2021-06-19 16 INFO 2814 33.392 INFO 4436-[main] com.demo.api.ApiApp
Lication: No active profile set, falling back to default profiles: def
Ault
2021-06-19 16 2814 37. 236 INFO 4436-[main] o.s.b.w.embedded.tomcat
.Tomcat WebServer: Tomcat initialized with port (s): 81 (http)
2021-06-19 16 INFO 2815 37.298 INFO 4436-[main] o.apache.catalina.core.
StandardService: Starting service [Tomcat]
2021-06-19 16 INFO 2815 37.298 INFO 4436-[main] org.apache.catalina.cor
E.StandardEngine: Starting Servlet engine: [Apache Tomcat/9.0.43]
2021-06-19 16 virtual 28 INFO 37.454 INFO 4436-[main] o.a.c.c..Tomcat.
Alhost]. [/]: Initializing Spring embedded WebApplicationContext
2021-06-19 16 w.s.c.ServletWebServerA 28V 37.470 INFO 4436-[main] w.s.c.ServletWebServerA
PplicationContext: Root WebApplicationContext: initialization completed in 3891
Ms
2021-06-19 16 INFO 2814 38.064 INFO 4436-[main] o.s.s.concurrent.Thread
PoolTaskExecutor: Initializing ExecutorService 'applicationTaskExecutor'
2021-06-19 16 INFO 2814 38.626 INFO 4436-[main] o.s.b.w.embedded.tomcat
.Tomcat webserver: Tomcat started on port (s): 81 (http) with context path''
2021-06-19 16 com.demo.api.ApiApp 28 INFO 38.642 4436-[main] com.demo.api.ApiApp
Lication: Started ApiApplication in 6.504 seconds (JVM running for 7.7
85)
4. FAQ 4.1. Solve the problem of Chinese garbled code in bat console
[phenomenon]
[solution]
The encoding of the start.bat file is set to UTF-8. Here is an example of Notepad++.
[effect after solution]
4.2.cd% ~ dp0 is not an internal or external command
[phenomenon]
D:\ apidemo > roomd D:\ apidemo\
'executable'is not an internal or external command, nor is it a runnable program
Or batch files.
[solution]
If there are other matches in start.bat, type the command again in Notepad++, or switch the code.
[effect after solution]
D:\ apidemo > cd D:\ apidemo\
The above is about the content of this article on "how to use bat to start a springboot project". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.