Read the content from URL

A forum to discuss Java programming related issues and concerns.
no avatar
naina
 
Posts: 2
Joined: Fri May 17, 2013 10:03 pm

Read the content from URL

by naina » Fri May 17, 2013 10:18 pm

I try out the below code

import java.net.*;
import java.io.*;

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

URL oracle = new URL("http://www.oracle.com/");
BufferedReader in = new BufferedReader(
new InputStreamReader(oracle.openStream()));

String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}



But im getting the html code of that URL,,,but i want a simple text on that URL

Return to JAVA Lobby

cron