Spring Boot Bootcamp – Workbooks and Challenges
)}

Workbook 1.3

In this workbook, you will run your application as a jar file. We will never use this method, but it's good to be familiar with it.

Download the resources

If you still haven't downloaded the resources, click here. Follow these steps to download the zip file.

a804cbd4-25d4-4bb1-826f-f35dd5660541.png

Unzip the resources into a folder.

Screen Shot 2022-07-15 at 3.49.08 PM.png

Launch the Starter Workbook

From spring-boot-bootcamp-resources > 1.intro-to-springboot > workbook-1.3 > starter, launch the workbook folder.

Screen Shot 2022-05-31 at 7.03.07 PM.png

Frequently Asked Question

  • Question: The mvnw wrapper command is 'not found'.
  • Answer: From your editor, only launch the workbook folder.

Screen Shot 2022-07-13 at 9.16.40 PM.png

This ensures that your terminal points to the exact folder that your wrapper is in.

Screen Shot 2022-07-13 at 9.19.56 PM.png

mvnw package

  1. Compiles your code.
  2. Packages everything in a JAR file inside target.

The name of your JAR file is determined by the artifact-id and version Screen Shot 2022-05-31 at 7.10.00 PM.png

SNAPSHOT means this version of your application is under development. Version 0.0.1 of our application is complete and stable, so remove SNAPSHOT.

Screen Shot 2022-05-31 at 7.12.26 PM.png

Package your application.

Screen Shot 2022-05-31 at 7.21.17 PM.png

The JAR file packages all of your application's compiled code. Now your application is portable.

Task

Drag the jar file to your Desktop.

Screen Shot 2022-09-22 at 9.53.00 PM.png

Instructions for Mac Users

Scroll down if you're a Windows user. From your Mac, launch a terminal.

Screen Shot 2022-05-31 at 7.26.41 PM.png

Enter the command cd to start from the root of your filesystem.

Screen Shot 2022-05-31 at 7.54.24 PM.png

The next cd command must direct the terminal to your Desktop directory.

Screen Shot 2022-05-31 at 7.55.16 PM.png

Your terminal now points to your Desktop. Run the jar file using the command java -jar workbook-0.0.1.jar.

Screen Shot 2022-09-17 at 12.54.22 AM.png

Instructions for Windows Users

Launch the Command Prompt from your start menu. Screen Shot 2022-09-17 at 12.42.12 AM.png

Your path should start at C:\Users\username Screen Shot 2022-09-17 at 12.44.31 AM.png

Enter the command: cd Desktop to go to your Desktop directory.

Screen Shot 2022-09-17 at 12.47.52 AM.png

Your command prompt now points to your Desktop. Run the jar file inside your Desktop using java -jar workbook-0.0.1.jar.

Screen Shot 2022-09-17 at 12.54.22 AM.png

Recap

  • mvnw package packages your application into a jar file.
  • java -jar runs all of the compiled classes inside of the jar file – essentially, running your app!

Feedback Summary
5.0
3 students
5

100%
4

0%
3

0%
2

0%
1

0%
Written Reviews
There are no written reviews yet.