Bird
0
0

You want to run your Spring Boot app as a standalone jar. Which command correctly runs the jar file named app.jar?

medium📝 Application Q15 of 15
Spring Boot - Fundamentals
You want to run your Spring Boot app as a standalone jar. Which command correctly runs the jar file named app.jar?
Amvn run app.jar
Bjava run app.jar
Cgradle run app.jar
Djava -jar app.jar
Step-by-Step Solution
Solution:
  1. Step 1: Recall how to run a jar file in Java

    The standard command to run an executable jar is 'java -jar filename.jar'.
  2. Step 2: Check other options for correctness

    The mvn and gradle commands are for build tools, not for running jar files directly. 'java run app.jar' is invalid Java command syntax.
  3. Final Answer:

    java -jar app.jar -> Option D
  4. Quick Check:

    Run jar with 'java -jar' = java -jar app.jar [OK]
Quick Trick: Run jar files with 'java -jar filename.jar' [OK]
Common Mistakes:
  • Using build tool commands to run jar directly
  • Omitting '-jar' option
  • Typing invalid Java commands

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes