# Packaging & Deployment — Advanced Java

Source: https://www.geekswithgeeks.com/en/advanced-java/adv-packaging

> Ship a Java service as an executable fat JAR, a trimmed jlink runtime image, or a container, and keep secrets and config outside the artifact.

## Ways to ship

An **executable (fat) JAR** bundles your code plus every dependency — `java -jar app.jar`. **jlink** builds a trimmed custom runtime image. A **container image** (often on a slim JRE base) is the standard for cloud deployment; pair it with a health endpoint and externalised config.

## Configure from the environment

Keep secrets and per-environment values out of the JAR — read them from environment variables or a config server. The same artifact should run unchanged in dev, staging and prod.
