Skip to content

Native Image Guide

Bernardusz edited this page Jun 9, 2026 · 1 revision

🐧 GraalVM Native Image Guide

Levtus is highly compatible with GraalVM Native Image, allowing you to compile your Java application into a standalone, lightning-fast binary with near-instant startup.

πŸš€ Prerequisites

  • JDK 25+ (GraalVM or standard OpenJDK)
  • GraalVM Native Build Tools (e.g., native-image utility)

πŸ›  Compilation Steps

1. Build a Fat JAR

First, package your application into a single JAR including the Levtus dependency.

2. Compile to Native

Run the following command in your terminal:

native-image -jar my-app.jar

πŸ›‘οΈ Known Considerations

Static File Probing

Levtus uses Files.probeContentType() to serve static files. On some platforms (like Linux), this may rely on system libraries or property files. Ensure your build environment includes these if needed.

Reflection Configuration

Levtus is designed to be reflection-free. However, if you use a JSON library like Gson or Jackson in your handlers, you must provide a reflect-config.json to GraalVM so it knows which classes to keep.

πŸ“ˆ Benefits

  • Startup: < 20ms
  • Memory: Reduced footprint (~20-40MB for simple apps)
  • Deployment: Single binary, no JVM installation required on the target machine.

🐧 Getting Started

🧩 Core API

πŸ“¦ Features

πŸ›‘οΈ Security & Stability

πŸš€ Performance & Deployment

🀝 Project

Clone this wiki locally