Green Green - 1 month ago 4
Java Question

Not able to read web page content

I am trying to read a web page content using below code. But it do not print the web content as is expected. There is no error seen on IDE. And there is no exception. Proxy is also not set. Could anyone guide why it might not be working


public class URLReader {
public static void main(String[] args) throws Exception {

URL oracle = new URL("");
BufferedReader in = new BufferedReader(
new InputStreamReader(oracle.openStream()));

String inputLine;
while ((inputLine = in.readLine()) != null)

The control do not go inside while loop as debugged. But in buffer reader obj , there is a java object seen


The URL is not an HTTPS URL, so you won't see any output when attempting to print the website's contents. Try running your program with this URL instead: