Proxy settings not used by cmd prompt

4.4k views Asked by At

I have windows server ( AWS Workspace ) which uses a proxy server for internet access. I set the proxy in "Network and Internet" -> "Proxy" -> "Manual proxy setup" -> and . After setting up the proxy, my internet access through the browser started to work fine. But, when I try to run my java code using the command prompt, the internet access fails and libraries fails to download. The same libraries are accessible via browser.

Is there anything specific to be done, to direct the internet traffic through proxy for cmd prompt?

We are using squid proxy.

1

There are 1 answers

0
Anders On

The "command prompt" does not have proxy settings.

Windows applications that use the WinInet or WinHTTP libraries for HTTP connections generally follow the users proxy settings. Applications/libraries that uses plain sockets do not get automatic proxy handling, they need to call WinHttpGetIEProxyConfigForCurrentUser to retrieve the proxy configuration.

For Java, you can try System.setProperty("java.net.useSystemProxies", "true");