Java

Control Rclone from Java using the remote control HTTP API with HttpClient.

Java 11+ includes a modern HttpClient that makes HTTP requests straightforward.

This is the recommended approach for interacting with Rclone's remote control API.

Usage

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class RcloneExample {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("http://localhost:5572/"))
            .build();
        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}

How is this guide?

On this page