Use proxy for http request in Eclipse
Asked Answered
O

2

7

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.

Olla answered 1/3, 2011 at 3:3 Comment(0)
A
19

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.

Amyloid answered 1/3, 2011 at 3:5 Comment(3)
It is arguments or environment?Olla
@Olla - Funny. My last three answers here had been to your questions. Strange coincidence indeed.Amyloid
Is it program's aruguments or VM arguments?Olla
G
1

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

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

Gone answered 18/4, 2018 at 11:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.