Set the downloader's inputs on its ProcessBuilder:

var command = new ProcessBuilder(
    "/usr/bin/curl", "--fail", "--max-time", "30",
    "https://downloads.example/data.csv");
var environment = command.environment();
environment.put("http_proxy", "http://proxy.example:8080");
environment.put("https_proxy", "http://proxy.example:8080");
command.inheritIO();
Process child = command.start();

The environment map starts as a copy of the Java process environment. These changes apply to later processes started by this builder; they do not update the parent terminal or another builder. Check inherited bypass variables if curl still goes direct. For a public HTTP download route, select the child’s endpoint from the HTTP proxy list.

The example inherits standard streams. Wait for the child, handle its exit status and retain the application's cancellation policy after start().

Java's http.proxyHost system property belongs to participating Java networking code. Curl uses its own options and environment. If the child is another Java program, supply its needed -D arguments before the main class or -jar; an environment variable merely named http.proxyHost does not set that property.

ХӀокхунах тера йаззамаш