These two commands do not give the Java launcher the same configuration. Use your HTTP proxy's host and port; the HTTP proxy list provides candidates for permitted public routes:

java -Dhttp.proxyHost=proxy.example.net -Dhttp.proxyPort=8080 -jar app.jar
java -jar app.jar -Dhttp.proxyHost=proxy.example.net -Dhttp.proxyPort=8080

In the first, the launcher receives system-property options. In the second, the tokens after app.jar become application arguments. Unless the application deliberately parses them, they do not set the JVM's proxy properties.

The same boundary applies when naming a main class instead of using -jar. Put JVM options before the class name and application-specific arguments afterward.

Inspect the real startup command generated by an IDE, service wrapper or launch script. Its field labelled “program arguments” may be different from its field for VM options.

Correct placement only supplies the property. The HTTP client still has to consume that Java networking configuration. For Apache HttpClient 5, opt the client into system properties. Proxy authentication needs its own supported interface.

Ũhoro ũhĩtĩte