When i compile and run the below code i am getting unknown host exception thrown.
import java.net.*;
import java.io.*;
public class URLReader {
public static void main(String[] args) throws Exception {
String result="";
// Create a URL for the desired page
URL url = new URL("https://www.google.co.in/?gfe_rd=cr&ei=URzCVNmFKIiBoAPlpoD4CA&gws_rd=ssl#q=jbutton");
// Read all the text returned by the server
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String str;
while ((str = in.readLine()) != null) {
// str is one line of text; readLine() strips the newline character(s)
result += str;
}
in.close();
System.out.println(result);
}
}
How do i set the proxy for the above code (Https and HTTP)? I am running the above code in Eclipse Kepler.