🎓 Top 15 Udemy Courses (80-90% Discount): My Udemy Courses - Ramesh Fadatare — All my Udemy courses are real-time and project oriented courses.
▶️ Subscribe to My YouTube Channel (178K+ subscribers): Java Guides on YouTube
▶️ For AI, ChatGPT, Web, Tech, and Generative AI, subscribe to another channel: Ramesh Fadatare on YouTube
In this article, you will learn how to run the Spring boot application using the command line in windows.
Quick Steps
You can quickly use the below commands to run a spring boot application from a command line.
1. Run the Spring boot application with the java -jar command:
$ java -jar target/myapplication-0.0.1-SNAPSHOT.jar
2. Run the Spring boot application using Maven:
$ mvn spring-boot:run
3. Run your Spring Boot application using Gradle
$ gradle bootRun1. Run the Spring Boot app with the java -jar command
If you use the Spring Boot Maven or Gradle plugins to create an executable jar, you can run your application using java -jar.For example, build your maven project using mvn clean install and change the directory to the current project directory and run the following command in cmd.
The Spring Boot Maven plugin includes a run goal that can be used to quickly compile and run your application. Applications run in an exploded form, as they do in your IDE.
$ java -jar target/myapplication-0.0.1-SNAPSHOT.jarIt is also possible to run a packaged application with remote debugging support enabled. Doing so lets you attach a debugger to your packaged application, as shown in the following example:
$ java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n \
-jar target/myapplication-0.0.1-SNAPSHOT.jar
2. Run the Spring Boot App with Maven Plugin
Note on Spring Boot Maven plugin
If you are using maven as a project management and build tool then make sure that you have added the spring-boot-maven-plugin to your pom.xml file.
The Spring Boot Maven plugin provides many convenient features:
- It collects all the jars on the classpath and builds a single, runnable "über-jar", which makes it more convenient to execute and transport your service.
- It searches for the public static void main() method to flag as a runnable class.
- It provides a built-in dependency resolver that sets the version number to match Spring Boot dependencies. You can override any version you wish, but it will default to Boot’s chosen set of versions.
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>
Maven Command to Run Spring Boot App
If you have installed Maven on your machine, then use the following Maven command to run a Spring Boot application:
$ mvn spring-boot:run
If you haven't installed Maven on your Machine, then use the following Maven command to run the Spring Boot application:
$ ./mvnw spring-boot:run3. Run the Spring Boot App with Gradle
The Spring Boot Gradle plugin also includes a bootRun task that can be used to run your application in an exploded form.
If you use Gradle, then use the following command to run your Spring Boot application:
$ gradle bootRunConclusion
In this article, you have seen how to run the Spring boot application using the command line in windows.
Also, check out Different Ways of Running Spring Boot Application
My Top and Bestseller Udemy Courses. The sale is going on with a 70 - 80% discount. The discount coupon has been added to each course below:
Build REST APIs with Spring Boot 4, Spring Security 7, and JWT
🆕 High-Demand
80–90% OFF
[NEW] Learn Apache Maven with IntelliJ IDEA and Java 25
🆕 High-Demand
80–90% OFF
ChatGPT + Generative AI + Prompt Engineering for Beginners
🚀 Trending Now
80–90% OFF
Spring 7 and Spring Boot 4 for Beginners (Includes 8 Projects)
🔥 Bestseller
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Building Real-Time REST APIs with Spring Boot - Blog App
🔥 Bestseller
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Building Microservices with Spring Boot and Spring Cloud
🌟 Top Rated
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Java Full-Stack Developer Course with Spring Boot and React JS
🔥 Bestseller
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Build 5 Spring Boot Projects with Java: Line-by-Line Coding
🌟 Top Rated
80–90% OFF
Testing Spring Boot Application with JUnit and Mockito
🔥 Bestseller
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Spring Boot Thymeleaf Real-Time Web Application - Blog App
🔥 Bestseller
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Master Spring Data JPA with Hibernate
🔥 Bestseller
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Spring Boot + Apache Kafka Course - The Practical Guide
🎓 Student Favorite
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Comments
Post a Comment
Leave Comment