Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run CutyCapt from Java by starting its command-line executable with ProcessBuilder, passing each option as a separate argument, waiting with a bounded timeout, and validating the output file. CutyCapt is not a Java library: it is a Qt/WebKit-based command-line renderer. Install it and its runtime first, then have Java launch commands such as cutycapt --url=https://example.com --out=/tmp/example.png.

What you need before writing Java code

  • A machine with the CutyCapt executable and its Qt runtime installed.
  • A writable output directory.
  • A display setup appropriate to your operating system. CutyCapt documentation does not promise a universal headless mode, so display-less Linux servers may need a virtual display arrangement.
  • A Java runtime with ProcessBuilder and InputStream.readAllBytes() (Java 9 or newer for the latter).

Install CutyCapt

On Kali Linux, the documented command is:

sudo apt install cutycapt

The package pulls Qt core, GUI/widgets, SVG, WebEngine, WebEngineCore, WebEngineWidgets, and C++ runtime dependencies. On another distribution, install its equivalent package and verify that the executable is on the PATH:

cutycapt --help

If that command is not found, use the absolute executable path in Java (for example, /usr/bin/cutycapt) or correct the service account’s PATH.

The minimal Java capture

This complete example captures a PNG, merges standard error into standard output, enforces a 90-second process limit, and checks that a non-empty file was produced.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Duration;
import java.util.List;
import java.util.concurrent.TimeUnit;

public class CutyCaptExample {
    public static void main(String[] args) throws Exception {
        Path output = Path.of("/tmp/example.png");
        List<String> command = List.of(
            "cutycapt",
            "--url=https://example.com",
            "--out=" + output,
            "--min-width=1280",
            "--min-height=900",
            "--delay=1500",
            "--max-wait=90000",
            "--javascript=on"
        );

        Process process = new ProcessBuilder(command)
            .redirectErrorStream(true)
            .start();

        String outputText = new String(
            process.getInputStream().readAllBytes(),
            StandardCharsets.UTF_8
        );

        boolean finished = process.waitFor(100, TimeUnit.SECONDS);
        if (!finished) {
            process.destroyForcibly();
            throw new IOException("CutyCapt timed out after 100 seconds");
        }

        int exitCode = process.exitValue();
        if (exitCode != 0) {
            throw new IOException("CutyCapt failed (exit " + exitCode + "): " + outputText);
        }
        if (!Files.isRegularFile(output) || Files.size(output) == 0) {
            throw new IOException("CutyCapt returned success but produced no data: " + outputText);
        }
        System.out.println("Saved " + output + " (" + Files.size(output) + " bytes)");
    }
}

ProcessBuilder receives a list, not one shell-quoted string. That keeps URLs, paths, headers, and request bodies as distinct arguments and avoids quoting bugs or accidental shell interpretation. The timeout around waitFor is separate from CutyCapt’s --max-wait: the first limits the child process itself, while the second limits page loading inside CutyCapt.

Choosing URL, output, and viewport options

URL and output

Use --url= for http:, file:, and other URL forms supported by your build. Use --out= for the destination. You can select a format explicitly with --out-format=; documented formats include PNG, PDF, SVG, JPEG, TIFF, GIF, and BMP. The filename extension alone should not be treated as a reliable format selector.

Viewport dimensions

--min-width and --min-height set the minimum capture viewport. Their documented defaults are 800 by 600. They are minimums rather than a guarantee that a responsive page will render exactly at those dimensions, so set both when testing a breakpoint-sensitive layout.

List<String> command = List.of(
    "cutycapt",
    "--url=https://example.com/dashboard",
    "--out=/tmp/dashboard.pdf",
    "--out-format=pdf",
    "--min-width=1440",
    "--min-height=1000",
    "--print-backgrounds=on"
);

Timing and JavaScript

JavaScript is controlled by --javascript=on|off. --delay adds a wait after loading, which is useful for client-rendered content, while --max-wait bounds the load (the documented default is 90,000 milliseconds). A delay cannot make an unsupported browser API work; it only gives supported scripts more time.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
"--javascript=on",
"--auto-load-images=on",
"--delay=3000",
"--max-wait=90000"

Choose the smallest delay that consistently allows your page to settle. Very long delays reduce throughput and still do not solve a page that is incompatible with the renderer.

Passing headers, methods, and request bodies

Custom headers and user agents

Repeat --header for each header required by the target. Keep credentials out of command logs and captured diagnostics. --user-agent, --app-name, and --app-version let you identify the request or reproduce a site-specific response.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
List<String> command = List.of(
    "cutycapt",
    "--url=https://internal.example/report",
    "--out=/tmp/report.png",
    "--header=Authorization: Bearer " + token,
    "--header=Accept-Language: en-US",
    "--user-agent=ReportRenderer/1.0",
    "--javascript=on"
);

For production systems, prefer an environment variable, secret manager, or an in-memory value and redact the assembled command before logging it.

GET, POST, and PUT

The documented method values are get, post, and put. Supply request data with --body-string or binary/base64 data with --body-base64.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
List<String> command = List.of(
    "cutycapt",
    "--url=https://example.com/search",
    "--method=post",
    "--header=Content-Type: application/x-www-form-urlencoded",
    "--body-string=q=java+capture",
    "--out=/tmp/search.png",
    "--max-wait=90000"
);

Confirm the endpoint’s expected content type and encoding. A successful process does not prove that the server accepted your payload.

Useful rendering and network controls

  • Images and plugins: --auto-load-images=on|off and --plugins=on|off.
  • Privacy: use the available private-browsing controls when the capture must not reuse local browsing state.
  • Zoom: --zoom-factor changes page scale; --zoom-text-only limits scaling to text.
  • Proxy: --http-proxy routes requests through a specified proxy.
  • Format and print appearance: combine --out-format with --print-backgrounds and, for PDF output, the page’s own print CSS behavior.

Option spelling and available values can vary by packaged build. Treat cutycapt --help on the deployment host as the final local contract.

A reusable Java wrapper with timeout and diagnostics

For a service, encapsulate execution and return both diagnostics and the output path. Drain the merged stream before waiting so a verbose child cannot block on a full pipe.

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.concurrent.TimeUnit;

public final class CutyCaptRunner {
    public static Path capture(String url, Path destination, long timeoutSeconds)
            throws IOException, InterruptedException {
        List<String> command = List.of(
            "cutycapt",
            "--url=" + url,
            "--out=" + destination,
            "--min-width=1280",
            "--min-height=900",
            "--javascript=on",
            "--delay=1500",
            "--max-wait=90000"
        );

        Process process = new ProcessBuilder(command)
                .redirectErrorStream(true)
                .start();
        String diagnostics = new String(
                process.getInputStream().readAllBytes(),
                StandardCharsets.UTF_8);

        if (!process.waitFor(timeoutSeconds, TimeUnit.SECONDS)) {
            process.destroy();
            if (!process.waitFor(2, TimeUnit.SECONDS)) {
                process.destroyForcibly();
            }
            throw new IOException("CutyCapt process timeout: " + diagnostics);
        }

        if (process.exitValue() != 0) {
            throw new IOException("CutyCapt exit " + process.exitValue()
                    + ": " + diagnostics);
        }
        if (!Files.isRegularFile(destination) || Files.size(destination) == 0) {
            throw new IOException("Empty or missing capture: " + diagnostics);
        }
        return destination;
    }
}

In a web service, run captures in a bounded executor rather than creating unlimited processes. Use unique temporary filenames, enforce maximum URL and body sizes, and restrict which hosts your application may request to reduce server-side request-forgery risk.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Why modern pages can fail even when Java reports success

CutyCapt renders through Qt/WebKit. That can be effective for legacy or straightforward pages, but a current site may depend on browser APIs, JavaScript behavior, CSS, fonts, or security features that this stack does not reproduce. A zero exit code only means the process completed; it does not certify visual fidelity.

Inspect the artifact

  • Open the PNG/PDF and check that scripts, fonts, images, and responsive layout are present.
  • Compare a known-good browser rendering at the same viewport.
  • Record the operating system, CutyCapt package version, display or virtual-display configuration, URL, options, and timestamp.

When to migrate

If the page requires current Chromium behavior, a Puppeteer/Chrome-based command-line tool such as capture-website-cli is a migration lead. It uses Puppeteer/Chrome and supports PNG, JPEG, and WebP output plus launch options. Evaluate browser-engine fidelity, JavaScript coverage, waiting and network controls, output formats, deployment footprint, licensing, and CI stability before replacing CutyCapt.

Troubleshooting CutyCapt from Java

“Cannot run program cutycapt”

The executable is missing or not on the Java process’s PATH. Install the package, call cutycapt --help as the same service account, or pass an absolute path.

Exit code is non-zero

Read the merged output captured from the child process. It commonly indicates an invalid option, inaccessible URL, unwritable destination, missing Qt dependency, or display initialization problem. Re-run the exact command outside Java to separate CutyCapt errors from Java argument construction.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The process hangs

Keep both --max-wait and a Java-side timeout. On timeout, destroy the process and then use destroyForcibly() if it does not exit. Check for stalled network resources, proxy failures, or a display server that is unavailable.

The file exists but is blank or incomplete

Verify that the file is non-empty, then inspect its contents. Increase --delay for supported client rendering, enable JavaScript and image loading, and confirm that required headers are present. If modern APIs or CAPTCHA/bot checks are involved, changing the delay will not fix the compatibility gap.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Fonts or images are missing

Check that the runtime can reach the asset hosts, that the service account can access installed fonts, and that proxy or certificate settings are correct. Test with a simple public page to distinguish environment problems from site-specific behavior.

It works locally but not in CI

Compare package versions, environment variables, permissions, network policy, and display configuration. CutyCapt’s documentation does not guarantee universal headless operation; use the CI system’s supported virtual display arrangement and preserve the exact setup in logs.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo is a hosted website screenshot API and MCP server. It accepts a URL in one request and returns PNG, JPEG, WebP, or PDF, so Java can call it without installing Qt, a display server, or a browser executable.

cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Java can make the same GET request with its HTTP client:

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Files;
import java.nio.file.Path;

var uri = URI.create("https://api.screenshotneo.com/v1/shot"
    + "?access_key=YOUR_API_KEY&url=https%3A%2F%2Fstripe.com");
var request = HttpRequest.newBuilder(uri).GET().build();
var response = HttpClient.newHttpClient().send(
    request, HttpResponse.BodyHandlers.ofByteArray());
if (response.statusCode() / 100 != 2) {
    throw new java.io.IOException("ScreenshotNeo HTTP " + response.statusCode());
}
Files.write(Path.of("shot.webp"), response.body());

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

See the ScreenshotNeo documentation for request options. Before capture, it accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the page verdict and billing with X-Page-Verdict and X-Billed headers. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.

The Free plan includes 1,000 shots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is included on every plan, and yearly billing gives two months free. Sign up free for ScreenshotNeo.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

FAQ

Can Java call CutyCapt on Windows?

Yes, provided a compatible CutyCapt executable, Qt runtime, and display setup are installed. Use the executable’s full Windows path if it is not on PATH, and keep arguments as separate ProcessBuilder list elements.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Does --delay wait for a specific DOM element?

It is a time delay, not an element-aware readiness check. If deterministic element or network-idle waiting is required, a current browser automation tool or hosted API may be a better fit.

Should I trust only the exit code?

No. Check the exit code, diagnostics, file existence, file size, and the rendered content. WebKit compatibility issues can produce a technically successful but unusable capture.

Frequently Asked Questions

Can Java call CutyCapt on Windows?

Yes, provided a compatible CutyCapt executable, Qt runtime, and display setup are installed. Use the executable’s full Windows path if it is not on PATH, and keep arguments as separate ProcessBuilder list elements.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does –delay wait for a specific DOM element?

No. It is a time delay. For element- or network-idle-based readiness, use a current browser automation tool or hosted screenshot API.

Should I trust only the exit code?

No. Also inspect diagnostics, file existence and size, and the rendered image or PDF.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.