I am able to write a java program to access a particular url , and get the data , but the data is in raw format and the complete source is printed in the terminal .

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

public class URLConnectionReader {
    public static void main(String[] args) throws Exception {
        URL go = new URL("http://www.google.com/");
        URLConnection uc = go.openConnection();

        BufferedReader in = new BufferedReader(
                                new InputStreamReader(
        String inputLine;

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

I want that raw data to be displayed as a web page. Is there any way to do that.

Recommended Answers

You can use SWT to open the browser and render the HTML from memory like given in the example at

You can find more helpful browser related SWT snippets at

Jump to Post

All 4 Replies

I was trying to the code for displaying the url content. but its not showing that specific url. Its shows some html format. what is the format of creating the url connection and it will display that webpage content. for example i would give https://www.google.com it have to display or connect to the webpage of google. pls do the needful.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.