Proxy settings not used by cmd prompt

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.

Source: Windows Questions