liveBook · Manning

Native executable

As explained in Quarkus in Action

A native executable is a standalone machine-code program that runs directly on a target operating system and processor architecture without requiring a managed runtime.

A native executable is a platform-specific machine-code build of a Quarkus application. GraalVM native-image compiles Java code ahead of time and includes the application code, required library code, language runtime, and linked JDK code. Closed-world analysis determines what the executable needs at run time. Unlike a runnable JAR, it runs without starting a JVM; a binary built for Linux will not run on Windows. section 2.4.1 section 2.4.2

To build and run one from a generated Quarkus project:

  • Use `./mvnw package -Pnative`, `./gradlew build -Dquarkus.package.type=native`, or `quarkus build --native`. section 2.4.4
  • Run the generated binary directly, for example `./target/quarkus-in-action-1.0.0-SNAPSHOT-runner`. Its filename may differ by platform. section 2.4.4
  • Allow more build time and memory than for ordinary packaging; native compilation can take several minutes. section 2.4.4

If GraalVM or Mandrel is unavailable locally, Quarkus can build inside Docker or Podman. Request this with `-Dquarkus.native.container-build=true`; Quarkus may also fall back to a container build when it cannot find `native-image`. This route produces a Linux executable, suitable for a Linux-based container image even when the host uses another operating system. section 2.4.5

Choose the format for the workload, not as an automatic final step. Fast startup makes native executables attractive for serverless deployments. A long-running JVM application can eventually achieve higher throughput through just-in-time optimization, while native compilation fixes its optimizations ahead of execution. section 2.5.1 section 1.2.2

How Quarkus in Action covers it

How deep it goes
Explains ahead-of-time compilation and platform specificity, then gives build and run commands without detailing GraalVM internals.
Examples
Builds a generated Quarkus application with Maven, Gradle, or the Quarkus CLI and runs its generated binary.
What it assumes
Introduces Java bytecode and JVM execution before the comparison; uses a generated Quarkus project for the build steps.
What you can do after
Operate/configure it with Quarkus build commands, including a container build, and choose it against JVM packaging for a target workload.
How it connects
Links native executables to GraalVM native-image, ahead-of-time compilation, JVM execution, Docker, Podman, and serverless deployment.

Also explained in

Compare how 4 books explain native executable →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quarkus in Action. The section links point to the parts of the book it draws on.