tags:

views:

377

answers:

7

Is it possible to use Java to build a web browser like Internet Explorer that will open all the web pages and display all the contents?

+7  A: 

The only valid answer to that question is:

Yes, it's possible to use Java to build a web browser.

However, a web browser is an exceptionally complex piece of software. Even Google, when building its Google Chrome browser, used existing technology to do it, rather than inventing their own browser from scratch.

If your goal is anything other than building and marketing your own browser, you may want to reconsider what exactly you want to accomplish, in order to find a more direct approach.

VoteyDisciple
would you like to chat with me on this topic??
prasad
@prasad: not to sound harsh or to demotivate you, but this is **a hell lot of** work. It wil involve years, if not a decade to achieve the level of MSIE/FF. If you're looking for partners to work on it from scratch, you're here at the wrong place. Your question is answered: it's possible. If you take a step back and elaborate a bit more about the functional requirement for which you thought that homegrowing a webbrowser is the solution, you'll probably get better suited answers how to achieve it the best way.
BalusC
+6  A: 

I advise you to take a look at the Lobo Browser project, an open-source java-written web browser. Take a look at the source and see how they did it.

luvieere
Hey thank u but how can i get the source code??
prasad
@prasad: There's a `Source Code` link somewhere halfway the navigation menu at the website.
BalusC
+2  A: 

Yes, it's possible, and here's what you would need to start looking at.

First, search for an HTML renderer in Java. An example would be JWebEngine. You can start by manually downloading HTML pages and verifying that you can view them.

Second, you need to handle the networking piece. Read a tutorial on sockets, or use an HTTP Client such as the Apache HTTPClient project.

Edit: Just to add one more thought, you should be honest with yourself about why you would work on this project. If it's to rebuild IE, FF, that is unrealistic. However, what you might get out of it is learning what the major issues are with browser development, and that may be worthwhile.

James Kingsbery
yup i actually want to learn how it can be done... I like to do things in java and so tye question arrived and i asked....
prasad
+1  A: 

Take a look at the JEditorPane class. It can be used to render HTML pages and could form the basis of a simple browser.

Adamski
A: 

The hardest thing will be the rendering component. Java7 will include JWebPane, that internally uses WebKit. Here you can find some screenshots.

gimenete
wasnt that dropped by Sun?
Tom J Nowell
+1  A: 

Yes, it is possible. JWebPane is a work in progress migration of Webkit. It is supposed to be included in JDK7 but I wouldn't hold my breath.

JWebPane browser = new JWebPane();
new JFrame(“Browser”).add(browser);
browser.load(someURL);

You can see the source code here: http://dlc.sun.com.edgesuite.net/jdk7/binaries/index.html

OscarRyz
Thank u... But i did not find the setup for jdk 7. The link what u gave took me to a winrar file of jre7.. I extracted it but what should be done next???
prasad
That's actually an alpha release, is not intended for final users. In that link there's another for source code. You can download it and read it through. Probably it would be better to wait to the formal release of JDK7 which will have a setup.
OscarRyz
OK thank u!!!! :-)
prasad
+1  A: 

Yes. One of the projects in Java After Hours shows you how to build a simple web browser. It's not nearly as full-featured as IE or Firefox of course (it's only one chapter in the book), but it will show you how to get started.

Bill the Lizard
OKKKKKK!!! thank u
prasad