Use proxy for http request in Eclipse

14,935

Solution 1

You need to pass these flags in your run configuration. Run -> Run configurations -> Select your project. Then in second tab: “Arguments”. Top box is for your program's arguments, and bottom box is for VM arguments. Add these two there as VM arguments.

-Dhttp.proxyHost=proxyserver.com  
-Dhttp.proxyPort=80

You can also set them in your code.

System.setProperty("http.proxyHost", "proxyserver.com");
System.setProperty("http.proxyPort", "80");

You can read more about them in java docs here.

Solution 2

If its still not working add these also as VM variables in run config.

-Dhttps.proxyHost=proxyserver.com
-Dhttps.proxyPort=80

Share:
14,935
user496949
Author by

user496949

Updated on July 19, 2022

Comments

  • user496949
    user496949 almost 2 years

    For debugging purposes, I need to configure Java to use a proxy for HTTP requests. I am wondering how to do it in my Eclipse environment when I press Ctrl + F11? Any help will be appreciated.

  • user496949
    user496949 over 13 years
    It is arguments or environment?
  • CoolBeans
    CoolBeans over 13 years
    @user496949 - Funny. My last three answers here had been to your questions. Strange coincidence indeed.
  • user496949
    user496949 over 13 years
    Is it program's aruguments or VM arguments?