Skip to main content
PercherPercher

Deploy guide · runtime = "docker"

Deploy Java (JDK 21) on Percher

Plain Java using `com.sun.net.httpserver.HttpServer` on Eclipse Temurin 21. The template intentionally has no Maven or Gradle — it's the smallest possible JVM HTTP server, ready for you to bolt on a build tool when you need one.

Why Percher fits

  • JDK 21 with virtual threads handles concurrency cheaply, no async framework needed.
  • The minimal template is the right starting point if you want to add Spring Boot, Micronaut, or Quarkus by hand instead of inheriting their conventions.

Quick start

bunx percher create my-app --template java
cd my-app
bunx percher publish

The first command scaffolds a working Java (JDK 21) project plus a `percher.toml`. Publish builds and deploys it; the live URL prints on completion.

percher.toml

The canonical config for a Java (JDK 21) app on Percher. `bunx percher init` generates this automatically when it detects Java (JDK 21) in your project.

[app]
name = "my-api"
runtime = "docker"
framework = "java"

[web]
port = 8080
health = "/health"

Common gotchas

  • Add Maven or Gradle to the Dockerfile when you need dependencies; the minimal template uses `javac` directly.
  • JVM startup is slower than Go/Rust/Bun — expect ~1–2 s cold start on the Free tier wake-from-sleep path.
  • `HttpServer.create(new InetSocketAddress(8080), 0)` — bind to `0.0.0.0` (or omit the host, which is equivalent) so the container's network namespace can reach it.

Related docs

Ready to deploy Java (JDK 21)?

Free plan, no credit card. Live in under a minute.

Sign up free

← Browse all deploy guides