How to add proxy support to Jsoup?

Himanshu picture Himanshu · Sep 20, 2011 · Viewed 42.2k times · Source

I am a beginner to Java and my first task is to parse some 10,000 URLs and extract some info out of it, for this I am using Jsoup and it's working fine.

But now I want to add proxy support to it. The proxies have a username and password too.

Answer

Yusuf Ismail Oktay picture Yusuf Ismail Oktay · Aug 9, 2012

You can easily set proxy

System.setProperty("http.proxyHost", "192.168.5.1");
System.setProperty("http.proxyPort", "1080");
Document doc = Jsoup.connect("www.google.com").get();