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.
Unzip the resources into a folder.
Launch the Starter Workbook
From spring-boot-bootcamp-resources
> 1.intro-to-springboot
> workbook-1.3
> starter
, launch the workbook
folder.
Frequently Asked Question
- Question: The
mvnw
wrapper command is 'not found'. - Answer: From your editor, only launch the workbook folder.
This ensures that your terminal points to the exact folder that your wrapper is in.
mvnw package
- Compiles your code.
- Packages everything in a JAR file inside
target
.
The name of your JAR file is determined by the artifact-id
and version
SNAPSHOT
means this version of your application is under development. Version 0.0.1 of our application is complete and stable, so remove SNAPSHOT
.
Package your application.
The JAR file packages all of your application's compiled code. Now your application is portable.
Task
Drag the jar
file to your Desktop
.
Instructions for Mac Users
Scroll down if you're a Windows user. From your Mac, launch a terminal.
Enter the command cd
to start from the root of your filesystem.
The next cd
command must direct the terminal to your Desktop directory.
Your terminal now points to your Desktop. Run the jar
file using the command java -jar workbook-0.0.1.jar
.
Instructions for Windows Users
Launch the Command Prompt from your start menu.
Your path should start at C:\Users\username
Enter the command: cd Desktop
to go to your Desktop directory.
Your command prompt now points to your Desktop. Run the jar
file inside your Desktop using java -jar workbook-0.0.1.jar
.
Recap
mvnw package
packages your application into ajar
file.java -jar
runs all of the compiled classes inside of the jar file – essentially, running your app!