Creating a simple web browser in Java is quite simple. Although i teach C++ (i must confess), for ease and speed of programming Java is great for beginners, especially for multi-platform GUI applications. That said, below is code for a simple Java based web browser. You could easily modify this code to browse the web for you autonomously (like a web trawling robot etc. great for advertising, or data mining – or just to create a quick search tool that does the work for you while you go have some lunch). You could also make a custom web browser for a special project – although don’t bother trying to compete against Firefox etc… especially if your only one person, it takes teams of people and many years to reach where we are today.
Just cut, paste, compile and run!
For those new to Java…
e.g.
To compile:
javac WebBrowser.java
To run:
java WebBrowser
Enjoy
Hi,
Hope you r doing gud.
I tried using the above code for web browser.
However, after running, I get the window where I can enter the url. But nothing seems to come.. I get connection refused error message. Do I have to do some settings change in IE ?
Hey It works fine for me Thanks a lot
C:\Users\Zeromin0\Desktop\WebBrowser.java:84: ‘try’ without ‘catch’ or ‘finally’
try
^
C:\Users\Zeromin0\Desktop\WebBrowser.java:88: illegal start of type
});
^
C:\Users\Zeromin0\Desktop\WebBrowser.java:89: expected
editable = new JCheckBox();
^
C:\Users\Zeromin0\Desktop\WebBrowser.java:90: expected
editable.addActionListener(new ActionListener()
^
C:\Users\Zeromin0\Desktop\WebBrowser.java:90: illegal start of type
editable.addActionListener(new ActionListener()
^
C:\Users\Zeromin0\Desktop\WebBrowser.java:92: illegal start of expression
public void actionPerformed(ActionEvent event)
^
6 errors
sorry I was wrong write
This code Works
But input needs to be improved
I was Wrong This Code Works
Sory
good work sir !!!
thanks a lot……:)
wow great tutorial sir..btw do you now how to adding encryption or mybe ssl certificate on this project.. so i can running https website.. thanks very much sir..
I have not thought to try that yet myself, but if you do extend the code further please link your post back to my original blog post.
nice piece of code. can you please suggest ways how to make this web browser to enable cookies?