How to plug a web browser like firefox into a java application

I am developing a sftware that conect to de internet and get a web page source code.
Problems i have.
im using URL clas and the open conect method
this is the source:
public String Connect(String pUrl) throws HtmlConnectionException{
        String lTxtHtml = "";
        String lLine = "";
        BufferedReader lInput = null;
        int lTimeout = 15000;
        URL url;
        try {
            if(gProxyIP != ""){              
                url = new URL("http",gProxyIP,Integer.parseInt(gProxyPort),pUrl);
            }else{
                url = new URL(pUrl);
            URLConnection urlc = url.openConnection();
            urlc.setDefaultUseCaches(false);
//            urlcsetReadlTimeout(lTimeout);
            lInput = new BufferedReader(new InputStreamReader(new DataInputStream(url.openStream())));
            while ((lLine = lInput.readLine()) != null) {
                lTxtHtml += (lLine) + "\n";
            lInput.close();
        } catch (SocketTimeoutException e){
             gLogger.severe(e.getMessage());
            //e.printStackTrace();
            lTxtHtml = "lTimeout";
            throw new HtmlConnectionException(lTxtHtml);
        } catch (MalformedURLException e) {
             gLogger.severe(e.getMessage());
            //ex.printStackTrace();
            lTxtHtml = "Bad URL";
            throw new HtmlConnectionException(lTxtHtml);
        } catch (IOException e) {
             gLogger.severe(e.getMessage());
            //ex.printStackTrace();
            lTxtHtml = "Invalid";
            throw new HtmlConnectionException(lTxtHtml);
        return lTxtHtml;
    }but i dont know how to handle redirection of pages becose some teimes when it redirect me to anoder page an snd me an 30X mensage it crash and throw an IO Exception.
Probelm 2
i show the source of the web page but wat i nned is to plug a web wrowser into my application that let me se the web page in one JPanel and its source hig ligted in a JEditPane.
becose i ned to parse tags to identify string automatically
or the otehr option is to plug my application into a web wrobser (as a plugin of firefox) an be a ble to run it when i chose it from a contextual menu
please. can u help me to find the way?

You can use the Runtime class for this. It can run any command. So, you can run the .exe file of your Web browser.
The following code will run Internet Explorer (assuming iexplorer.exe is in C:\Program Files\Internet Explorer):
import java.lang.Runtime;
public class Explore{
public static void main(String[] args) {
try{
Process p = Runtime.getRuntime().exec("C:\\Program Files\\Internet Explorer\\iexplore");
}catch (Exception e) {
System.out.println("Exception: " + e);

Similar Messages

  • How do export my stuff from my old web browser to firefox?

    When I first installed FireFox I didn't know if I was going to like it and want to keep it so I said "no" to export my things from my old web browser to FireFox but I love FireFox and now I want my things switched over...so how do I do this now?

    See this Excellent Link by Pondini...
    Transfer from Old  to New
    http://web.me.com/pondini/AppleTips/Setup.html

  • Aladdin eToken using the Web browsing with Firefox. Firefox often asked to enter a password eToken. How to turn off the continuous requests?

    Aladdin eToken using the Web browsing with Firefox. Firefox often asked to enter a password eToken. How to turn off the continuous requests

    I have found a solution.
    For all they wont use a etoken to surf.
    Go to extras, options then extendet and go to cryptographic module and unload the etoken. To unload the etoken you must selekt etoken not the name of the token.
    i have translate the menu names from german to english.

  • How To Customize A web browser when running an application

    Hi,
    I have a little problem.
    I want to customize my web browser when i will deploy the application.
    fore example The browser Firefox have the following tabs: (File--Edition--History--BookMarks etc...)
    How can I proceed to avoid displaying these tabs in the page of the deployment of my application.
    Thanks Jdeveloper lovers

    Hi,
    Thank you shay it was a great step for the solution ,
    I can avoid watching Unwanted tabs.
    I hope frank you are not ungry against me ;)
    I am obliged it is a professional Requirement.
    Thank you for all Jdeveloper Lovers

  • Using Java 5, how to develop customizable web-pages  like iGoogle ?

    Is it possible to develop customizable web-pages like iGoogle does, using Java 5 ( simply using JSPs, servlets, JSFs, AJAX etc. and without using portals) ?
    A simple example explaining how to provide 3-4 header graphics options ( like igoogle does) will be helpful. (iGoogle seems to create a cookie, which appears to be used to render the selected header-graphics).
    TIA
    Edited by: DevelopingJava2005 on Jul 7, 2008 9:36 AM

    Without using portals?
    Google uses RSS feeds to compile their mashups on iGoogle. The positioning of those boxes are managed with AJAX and upon placement are saved into a session so they stay there for each visit after.
    Please be a little more clear as to what you are looking for. Yes, it is possible to develop web pages using the technologies you specified to simulate something like iGoogle, so give us some more details on what exactly you're looking for.
    Code wouldn't hurt either.

  • How to develop a web browser using API javatv?

    How to develop a web browser using API javatv?
    I'm tryin' to build a web browser using the API javaTv and
    I want to know if that is possible and if somebody already made this.
    This web browser will run a page developed in jsp.
    Thanks.

    You don't need JavaTV to write a web browser.
    Whichever Java platform you're using with JavaTV should provide enough.

  • Can I use Safari as my main web browser and Firefox when Safari isn't supported?

    Can I use Safari as my main web browser and Firefox when Safari isn't supported?

    www.apple.com/support/safari
    Also use the User Agent and see if that works on those sitess.
    Safari keeps a lot of web history and cache on disk and it tends to be RAM hungry (even FF has gotten a big larger on RAM footprint)
    There are other browsers and sometimes Opea is a good choice or there is OmniWeb which I still after 10 yrs? still favor.

  • How to add images into a java application (not applet)

    Hello,
    I am new in java programming. I would like to know how to add images into a java application (not an applet). If i could get an standard example about how to add a image to a java application, I would apreciated it. Any help will be greatly apreciated.
    Thank you,
    Oscar

    Your' better off looking in the java 2d forum.
    package images;
    import java.awt.*;
    import java.awt.image.*;
    import java.io.FileInputStream;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    /** * LogoImage is a class that is used to load images into the program */
    public class LogoImage extends JPanel {
         private BufferedImage image;
         private int factor = 1; /** Creates a new instance of ImagePanel */
         public LogoImage() {
              this(new Dimension(600, 50));
         public LogoImage(Dimension sz) {
              //setBackground(Color.green);      
              setPreferredSize(sz);
         public void setImage(BufferedImage im) {
              image = im;
              if (im != null) {
                   setPreferredSize(
                        new Dimension(image.getWidth(), image.getHeight()));
              } else {
                   setPreferredSize(new Dimension(200, 200));
         public void setImageSizeFactor(int factor) {
              this.factor = factor;
         public void paintComponent(Graphics g) {
              super.paintComponent(g);
              //paint background 
              Graphics2D g2D = (Graphics2D) g;
              //Draw image at its natural size first. 
              if (image != null) {
                   g2D.drawImage(image, null, 0, 0);
         public static LogoImage createImage(String filename) { /* Stream the logo gif file into an image object */
              LogoImage logoImage = new LogoImage();
              BufferedImage image;
              try {
                   FileInputStream fileInput =
                        new FileInputStream("images/" + filename);
                   image = ImageIO.read(fileInput);
                   logoImage =
                        new LogoImage(
                             new Dimension(image.getWidth(), image.getHeight()));
                   fileInput.close();
                   logoImage.setImage(image);
              } catch (Exception e) {
                   System.err.println(e);
              return logoImage;
         public static void main(String[] args) {
              JFrame jf = new JFrame("testImage");
              Container cp = jf.getContentPane();
              cp.add(LogoImage.createImage("logo.gif"), BorderLayout.CENTER);
              jf.setVisible(true);
              jf.pack();
    }Now you can use this class anywhere in your pgram to add a JPanel

  • How can I manipulate Selenium IDE addon in my own java application..??

    How can I manipulate Selenium IDE addon using my own java application..??
    Is there any .jar file available for it..??
    Actually I'm working on a project of automation framework. For this I want to link the "Record" button and "Menu bar"(at the top of the IDE).
    I'm using Eclipse on Win7 Ultimate(x64).
    Please provide the required links or documentations.
    I would really appreciate your kind help..

    I'm sorry, we don't generally have that kind of information in this forum. I'd suggest asking the developer of the add-on. If you're using [https://addons.mozilla.org/en-us/firefox/addon/selenium-expert-selenium-ide/ Selenium Expert (Selenium IDE)], the support link listed is http://blog.reallysimplethoughts.com/

  • How to assign the Thems into Webdynpro Java Application

    HI All,
                   I Downloaded the plugin for them editor and i add those plugins and i created the Them. Please any one can help me how to add that Them into Webdynpro java application.

    Hi ep bhargav,
    You can check this link.....
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ccb6bcf4-0401-0010-e3bc-ec0ef03e13d1
    Re: webdynpro theme editor
    Thanks.
    Venkat.

  • How I would get rid of Firefox if I didn't like it AND just how would I take if off my system AND will it interfere with any other web browser like yahoo ? ALSO where so I go to find these answers ???

    If I download Firefox then decide to remove it - will it interfere with my other web browsers like Yahoo - where are these answers????

    Firefox is easy to remove see [[uninstalling firefox]]
    I imagine many people use multiple browsers, the usual interference is in deciding which one is to be the default browser. You may use firefox without setting it as the default browser.

  • I want to get a phone number to directly call Mozilla Firefox and I also want to enable the Norton Search in my Mozilla Firefox web browser like it's enabled in

    I want to enable the Norton Search in my Mozilla Firefox Web Browser just like it is enabled in my default Internet Browser of Google Chrome right now today!!!!

    Hello,
    We do not have a phone # for technical support unfortunately. There are issues with Norton Toolbar causing Firefox to crash; This has been fixed in the 2013 version of Norton but not in 2012 yet. If you have 2013, it would be easier to contact Norton as they have a better understanding of how to guide you.

  • How I make the Web Browser Control to display a PDF in Windows 8

    I have an application that run ok in previous version of windows,  Where I can load a PDF file and the web browser control automatically use the Reader OCX of Adobe,, After Install windows 8 and download the reader for windows 8 still get and (X) where the document should be displayed.  I use the following command in my program to force the windows 8 to use the same web browser (10) in my web browser control.
    WebBrowser1.Navigate(DocumentName,"",Nothing,"User-Agent:Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)")
    But still get an  (X). IF I use the URL that is in the property of the (X) and paste in my regular IE10, it open the PDF file.

    Adobe Reader Touch is a Windows Store app and does not install a browser add-on/plug-in for "in-browser" PDF viewing.
    You can either
    Install Adobe Reader XI (desktop app) which installs browser plug-ins for Microsoft IE and Mozilla Firefox
    Use Google Chrome, which has a built-in PDF viewer (enabled by default)

  • How to close the web browser

    How can I be sure the web browser and all screens are completely closed on the droid 2

    Why is closing the browser important? Are you concerned about battery life?
    To close any app that is running you can go to Settings > Applications > Manage Applications > Running and force stop on the browser.
    It is certainly harder than on PC or MAC platforms, and even on some other smartphones.  At the same time, in many smartphones including Windows Mobile, iPhone, BB and others, the general model is different than computers - the general approach is that well behaved applications in essence are meant to be demanding no CPU when they are not in focus, unless there's some explicit background function like periodically obtaining e-mail and such.
    Certainly this may not always be the case, especially if an app is not coded correctly - but generally the guidelines for developers of smartphone code across multiple platforms discourages having an exit button and instead focuses on how to make sure an app is well behaved and low in demand during expected prolonged periods of dormancy.

  • How to open a web browser from an windows phone app

    Hi everyone,
    I am pretty new to Windows Phone 7, and now what I am trying to do is to create a simple app. When a user click to start this app, a browser will open and show the content of a webpage from a specific address.
    I tried to use a webbrowser object, but it seems like that doesn't sport cookies. So I need my app to open a real web browser (maybe IE mobile) to do the job.
    Thank you.

    copying from stackoverflow: "If you want to embed a browser window inside your application then use  the WebBrowser control.  Add an instance of the WebBrowser control to  your form then you can reference it in code using the name you
    give  it.  (Default name is "webBrowser1")"
    Microsoft MVP J# 2004-2010, Borland Spirit of Delphi 2001

Maybe you are looking for