---
title: "Chrome headless modes with Java SDK"
canonical_url: "https://www.nutrient.io/guides/java/deployment/headless-modes-google-chrome/"
md_url: "https://www.nutrient.io/guides/java/deployment/headless-modes-google-chrome.md"
last_updated: "2026-05-26T21:54:59.587Z"
description: "Run the packaged Docker sample for Chrome-backed conversions with Java SDK."
---

# Chrome headless modes with Java SDK

This guide shows how to run the [packaged Docker sample](https://www.nutrient.io/downloads/samples/java/headless-modes-google-chrome.zip) for Chrome-backed conversions with Java SDK.

## Run this packaged Java sample with Docker

From the packaged sample folder, run:

```bash

docker run --rm \
  --platform linux/amd64 \
  --security-opt seccomp=chrome-seccomp.json \
  -w /app \
  -v "$PWD:/app" \
  -e HOME=/home/appuser \
  "$(docker build -q --platform linux/amd64 -f Dockerfile.)" \
  /bin/sh -c 'chmod -R o+rwX /app && exec runuser -u appuser -- mvn compile exec:exec'

```

## Run this packaged Java sample with Docker Compose

From the packaged sample folder, run:

```bash

docker compose -f docker-compose.yml run --build --rm appuser

```

If the run succeeds, the package writes `output.pdf` to the sample folder.

You can also download [this packaged sample](https://www.nutrient.io/downloads/samples/java/headless-modes-google-chrome.zip) and run it directly.

## What this packaged Java sample does

The packaged Java sample loads the included `input.html` file and writes the converted result to `output.pdf`.

Email conversion workflows such as MSG and EML to PDF also rely on Chrome-backed rendering in Docker.

The SDK code executed by the packaged sample is:

```java

package io.nutrient.Sample;

import io.nutrient.sdk.Document;
import io.nutrient.sdk.exceptions.NutrientException;

public class HeadlessModesGoogleChrome {
    public static void main(String[] args) throws NutrientException {
        try (Document document = Document.open("input.html")) {
            document.exportAsPdf("output.pdf");
        }
    }
}

```

## Related guides

- [Java SDK guides](https://www.nutrient.io/guides/java.md)
---

## Related pages

- [Nutrient Java SDK deployment guides](/guides/java/deployment.md)

