# Quick Start

Build your first self-contained binary in under 5 minutes.

## Basic Usage

```bash
# Build from project directory
jbundle build --input ./my-app --output ./dist/my-app

# Run the binary (no Java required)
./dist/my-app
```

## By Build System

### Clojure (deps.edn)

```bash
jbundle build --input ./my-clojure-app --output ./dist/app
```

Requires a `:build` alias with `tools.build` configured to produce an uberjar.

### Clojure (Leiningen)

```bash
jbundle build --input ./my-lein-app --output ./dist/app
```

Runs `lein uberjar` internally.

### Java (Maven)

```bash
jbundle build --input ./my-java-app --output ./dist/app
```

Runs `mvn package -DskipTests` internally. Requires a configured shade/assembly plugin for uberjar.

### Java (Gradle)

```bash
jbundle build --input ./my-gradle-app --output ./dist/app
```

Runs `gradle build -x test` internally. Requires a configured [ShadowJar](https://github.com/GradleUp/shadow)/fatJar task to create an uberjar.

```kotlin
plugins {
    id("com.gradleup.shadow") version "8.3.0"
}

tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>().configureEach {
    mergeServiceFiles()
    duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
```

For larger projects `isZip64 = true` needs to be added.

### From Pre-built JAR

If you already have an uberjar:

```bash
jbundle build --input ./target/app.jar --output ./dist/app
```

This skips the build step and goes straight to packaging.

## What Happens

On first run of the output binary:

1. **Extract** — Runtime and app are extracted to `~/.jbundle/cache/`
2. **Generate AppCDS** — JVM creates shared class archive (one-time, \~2-5s)
3. **Run** — Application starts

On subsequent runs:

1. **Cache hit** — Everything already extracted
2. **Load AppCDS** — JVM loads pre-processed metadata
3. **Run** — Application starts fast (\~200-350ms)

## Common Options

```bash
# Specify Java version
jbundle build --input . --output ./dist/app --java-version 21

# Use CLI profile (optimized for fast startup)
jbundle build --input . --output ./dist/app --profile cli

# Cross-compile for Linux
jbundle build --input . --output ./dist/app --target linux-x64

# Pass JVM arguments
jbundle build --input . --output ./dist/app --jvm-args "-Xmx512m"
```

## Next Steps

* [Configuration](/user-guide/configuration.md) — Use `jbundle.toml` to avoid repeating flags
* [JVM Profiles](/user-guide/profiles.md) — Understand `cli` vs `server` profiles
* [CLI Reference](/reference/cli.md) — Full command documentation


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jbundle.avelino.run/getting-started/quick-start.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
