0Pricing
Java Academy · Lesson

Packaging & Running

Package a Spring Boot app into a JAR and run it in different ways.

Packaging & Running is a free Java Academy lesson on CoddyKit — lesson 3 of 3. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Java Academy learning path, one of 3 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Intro

Packaging means building a distributable JAR file that contains your Spring Boot app.

Maven build

Run mvn clean package. It produces a fat JAR under target/.

Code: packaging demo

This demo prints the idea of packaging into a JAR.

public class Main {
  public static void main(String[] args) {
    System.out.println("Packaging Spring Boot app...");
    System.out.println("Created target/app.jar with all dependencies.");
  }
}

Run app

Run with java -jar target/app.jar. Spring Boot launches the embedded Tomcat.

Code: run output

This simulates console output of java -jar.

public class Main {
  public static void main(String[] args) {
    System.out.println("Launching app on port 8080...");
    System.out.println("App started successfully. Press Ctrl+C to exit.");
  }
}

Docker note

You can also package into a Docker image, then run docker run -p 8080:8080 app.

Packaging check

Quick check: Which command runs a packaged Spring Boot JAR?

Recap

Recap: Built with Maven, ran with java -jar, saw console output, and noted Docker option.

Frequently asked questions

Is the “Packaging & Running” lesson free?

Yes — the full text of “Packaging & Running” is free to read here on the web, and the Java Academy course includes 3 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Java Academy course, upgrade to CoddyKit PRO.

What will I learn in “Packaging & Running”?

Package a Spring Boot app into a JAR and run it in different ways. You practise Java Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Java Academy?

No prior experience is required. Java Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 3, so you can start here or from the beginning and move at your own pace.

How long does the “Packaging & Running” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Java Academy lesson?

Yes. Every Java Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Testing Spring (WebTestClient/JUnit)
  2. Config & Profiles
  3. Packaging & Running
← Back to Java Academy