Open Internet explorer from Java

Hi everyone!
Doew anybody know how to open IOnternet Explorer from Java.I have tried
String browserCommand = ("\"C:\Program Files\InternetExplorer\iexplore.exe\"");
     URL theUrl=new URL("http://www.yahoo.com/"); // or whatever
     Runtime.getRuntime().exec(browserCommand+ " "+theURL);
but something goes wrong with the escape characters I use.
I would be greatful to receive any advice.
Thanks in advance!

or...
    private static boolean showInBrowser(String url){
         String os = System.getProperty("os.name").toLowerCase();
        Runtime rt = Runtime.getRuntime();
        try{
             if (os.indexOf( "win" ) >= 0) {
                  // this doesn't support showing urls in the form of "page.html#nameLink"
                 rt.exec( "rundll32 url.dll,FileProtocolHandler " + url);
             } else if (os.indexOf( "mac" ) >= 0) {
                 rt.exec( "open " + url);
             } else if (os.indexOf( "nix") >=0 || os.indexOf( "nux") >=0) {
                  // Do a best guess on unix until we get a platform independent way
                  // Build a list of browsers to try, in this order.
                  String[] browsers = {"epiphany", "firefox", "mozilla", "konqueror",
                            "netscape","opera","links","lynx"};
                  // Build a command string which looks like "browser1 "url" || browser2 "url" ||..."
                  StringBuffer cmd = new StringBuffer();
                  for (int i=0; i<browsers.length; i++)
                       cmd.append( (i==0  ? "" : " || " ) + browsers[i] +" \"" + url + "\" ");
                  rt.exec(new String[] { "sh", "-c", cmd.toString() });
             } else {
                  return false;
        }catch (IOException e){
             return false;
        return true;
    }

Similar Messages

  • How to open Internet explorer from java

    how can one open internet explorer through java and also displays the desired webpage in it.

    p = r.exec(runie);Whenever you use exec on a Runtime object, you need to get an InputStream off the System.err output. If this InputStream is not absorbed in some way, then it can stop the process. The process may not reach its destined finish point. The Java Documentation does not inform you of this, though experience will give you some unanswered questions, such as 'Why does this process never reach the finish point'.
    James

  • Lauching Internet Explorer from java program

    How can I lauch internet explorer from a java program. I need codes
    Thanks

    What? Is this the Question of the Day or something?
    http://forum.java.sun.com/thread.jsp?forum=31&thread=342624&tstart=0&trange=30

  • Open an Explorer from Java

    How i can open the default explorer from Java and redirect it to an especific URL?

    here is a code snippet that might help.
       public StringBuffer getMainPage (String host, String port, boolean sendToBrowser)
          String       url  = "http://" + host + ":" + port;
          String       line = "";
          StringWriter sw   = new StringWriter();
          // send it.
          post(line, url, sw);
          try
             if ( sendToBrowser )
                // send the default browser to the proper page for this host
                String cmd = "rundll32 url.dll,FileProtocolHandler " + url;
                // System.out.println("cmd =" + cmd );
                Process p = Runtime.getRuntime().exec(cmd);
          catch ( Exception e )
             // e.printStackTrace();
          // System.out.println(" output ='" + sw.toString() + "'" );
          if (sw.toString().length() != 0)
             return sw.getBuffer();
          else
             return null;
       }

  • Opening Internet Explorer from Air Iframe

    This probably has been answered here before and I apologize if this is a repost but I haven't been able to find an answer that works.
    I have an AIR application that uses an Iframe to connect to a server side page. within that page I need to be able to click a link and launch an Internet Explorer Browser NOT an Air window.
    I have tried several methods and none seems to work,
    does anyone have a sample (both the parent and child frames) that they know works ,
    It will save me allot of headache
    I truly appreciate it 
    Ray

    Thanks but I would need the complete code.
    You see I want to open a particuler page from a link, the link will call, lets say homepage.jsp, I want to include an applet in homepage.jsp that will force the page to open up in a IE window. Is that possible????
    If it is what do I need to do?
    Thanks

  • Opening Internet Explorer from a link w/ applet

    Hi there,
    I was wondering if anybody out there had the code for an applet that will spawn Internet Explorer application and open up a specific address.
    How we want it to work. From a link open a page that will spawn Internet Explorer with the help of the applet. Is it do-able or not?
    A quick response would be great.
    Thanks

    Thanks but I would need the complete code.
    You see I want to open a particuler page from a link, the link will call, lets say homepage.jsp, I want to include an applet in homepage.jsp that will force the page to open up in a IE window. Is that possible????
    If it is what do I need to do?
    Thanks

  • Why does it open internet explorer from my mail to open another page now when it didnt before

    when i go to go from my mail to a page it opens up internet explore to do it and not fire fox i cant get in to change the settings to see if they are set right

    Sounds like Firefox isn't your Default Browser.
    https://support.mozilla.com/en-US/kb/How%20to%20make%20Firefox%20the%20default%20browser

  • How can I open Internet Explorer from Forms?

    I could manage to open IE with HOST giving it the correct path from IE in my computer.
    But how can I find out what directory IE is? Should I use OLE2? If yes, then how do I use it?
    Thanks,
    Ariadne

    I thinck that the path doesn't matter...
    Using Host('start http://www.oracle.com') will work no matter where IE is located

  • Problem in Opening HTML Page in Internet Explorer from my Swing Application

    Hi,
    I am opening a HTML file in Internet Explorer from my swing application.I am using the code given below
    private final static String WIN_FLAG = "url.dll,FileProtocolHandler";
    private final static String WIN_PATH = "rundll32";
    String cmd = WIN_PATH + " " + WIN_FLAG + " " + url;
    // url is HTML file Path
    Process p = Runtime.getRuntime().exec( cmd );
    Here there are two things i need to address ...
    1)The HTML file is opening up,but it always opens behind the swing application,that makes me every time to maximize the HTML file after it being opened up.I want to open it in front of the Swing Application.I need to implement "Always On Top" functionality for the html page.
    2)Whenever i trigger action to open different HTML page,it opens in new Internet Explorer window.
    I need to open it in same IE window.
    how to solve out these problems ??? any help would be greatly appreciated .Thanks in advance.
    - Manikandan

    any idea about this ????

  • Opening HTML file from java GUI

    Can someone please tell me how I can open a HTML file in Internet Explorer from a Java GUI,
    I have an asssignment I am doing for college and I was toying with the idea of putting in helpfiles, for the program, can anyone tell me the easiest way of apcomplishing this???
    Thanks in advance for your help,
    Kaspah

    Although this should answer your question, there are other (cross platform) ways to do what you want. As opposed to your "must have internet explorer" solution. Swing has a built in html viewer you might use, for example. I've been doing some reading on java/xml solutions. I don't consider myself knowledgeable enough (yet) to comment on that solution though. A delimited text file would be another solution. Useing that solution you could treat the file like a set of parrallel arrays on the hard drive and disply your text on pre-formated labels. Anyway, here is a link to you answer......
    http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Runtime.html#exec(java.lang.String)
    Ron_W

  • Message "Do you mean to switch apps? Reader is trying to open Internet Explorer" in blue bar. Why

    First time user.  Instructions on how to use not clear.  My problem is the message "Do you mean to switch apps?  Reader is trying to open Internet Explorer?" suddenly appeared in blue bar.  Occurs with I click on links in PDF.  What caused this?  How to fix?  How to avoid it from happening again?
    Same conflict with email links, just different message: "Do you mean to switch apps? Reader is trying to open mail?"
    Goal:  Do not want to switch apps and do not want to be asked this question.
    Environment: Windows 8, file developed in Publisher 365, Reader 10 "I think" 

    Pat
    Thank you for responding.  I have recreated the error, but cannot figure out how to use Snipping Tool to get screenshot of a Windows 8 panel.  Have the tool placed in the tool bar, but tool bar not accessible on the PDF display.  Any suggestions?
    Perk

  • How to open Internet Explorer files?

    I have a bunch of Internet Explorer files that I transferred from my old OS 9 iMac. Now, it seems, I can't open any of them. These are web pages I saved for research purposes, and I would really like to open them if at all possible. It was suggested that Opera 9 could open Internet Explorer files; but, I tried that and it didn't work. Does anyone know how I might do that?
    Carl Kalwaitis

    Archives that you saved with Internet Explorer can only be opened by Internet Explorer.
    These are essentially a single file that contains the entire site.
    Other browsers save files, pictures, and supporting information in a folder for each page you save.
    But, Internet Explorer wraps all that into a single file (a web archive). This format is naturally only compatible with Internet Explorer.
    You need to get the latest version of Internet Explorer for Mac OS X.
    Microsoft has officially abandoned this browser. So, they are not offering it or supporting it anymore.
    But, you can still locate a copy for downloading at:
    http://web.nickshanks.com/browsers/ie/macosx
    Hope this helps.

  • When i run firefox setup all that shows up on my pc four shortcuts that open internet explorer

    I downloaded and saved firefox set up and when i ran it a window showed the extraction but then nothing happened. i searched for mozilla and found only 4 shortcuts that open internet explorer.

    If your Firefox is in FullScreen '''press F11 key''' OR move your Mouse cursor to the top of the window, right-click and Remove Checkmark from '''Hide Toolbars'''
    -> Tap ALT key or press F10 to show the Menu Bar
    -> go to View Menu -> Toolbars -> select '''Menu Bar''' and '''Navigation ToolBar'''
    -> press '''CTRL + B''' for '''Bookmarks Sidebar'''
    Check and tell if its working.

  • How can I open Internet explorer only pages on a mac? The website that I need to access only permits internet explorer

    How can I open Internet explorer 'only' pages on a mac, without creating a drive partition and installing windows separately?
    I've tried winbottler, but it doesn't seem to serve my purpose. The web site that I'm trying to access only permits Internet explorer.

    Microsoft has not written IE for Mac for years so unless you want to create a parition and install Windows, or user a Windows emulator, you're out of luck for installing IE on a Mac.
    The web site that I'm trying to access
    There might be a work around for you since it's just the one site.
    Go to the Safari menu bar click Safari > Preferences then select the Advanced tab.
    Enable the Develop menu.
    Now click Develop from the Safari menu bar then click User Agent > IE 9, 8, or 7

  • Google desktop and Picasa open Internet Explorer even though Firefox is my default browser

    I am using Firefox 6, and no matter what I do clicking on Google Desktop opens Internet Explorer instead of Firefox. I have set Firefox as the default browser in at least 3 places: In Firefox itself; on the Internet Options section of the Control Panel; In the add/remove programs Set Default Programs screen. This is all in Windows XP professional. The same problem happens with Picasa online albums (when I go from my computer's Picasa to Web Albums). I don't know when this started, but now I cannot get my Web timeline. I have uninstalled Google Desktop.

    Hello nanemy1854, set also firefox as default browser in Add or Remove Programs list in win xp, see for more information : [https://support.mozilla.org/en-US/kb/setting-firefox-default-browser-does-not-work#w_windows-xp Firefox as default browser in win xp].
    thank you

Maybe you are looking for

  • Will connecting to TV give better graphics

    I can't play some games on my bootcamp partition because my graphic card is not good enough (imac mid2010 21.5"). If I connect to TV via mini display/thunderbolt and HDMI will i be able to run the game. Are TV graphics better than iMac's...?

  • Keynote file vanished into thin air

    I have recently encountered this extremely frustrating situation where my keynote file that contained over 100 slides just disappeared into thin air. It is not located in the folder where it's supposed to be and does not appear under recently open fo

  • Redeploying Application Error

    Hello, I am having an issue when I try to do update to an application I have deployed to weblogic 10.3.6 I get a NoClassDefFoundError. However if i delete the application, shut down the server, start it back up, and re-install the application everyth

  • IPhoto 11 writes in Events "No photos"

    I have many pictures in iPhoto events. One week ago iPhoto doesn't open picteres in Event menu My pictures still availble in Pictures menu, but not availble at Events? Why?

  • Computer has to restart

    My IMac has been running slow lately. The spinning wheel makes an appearance all the time and now when online, I am instructed to restart the computer after about five minutes or less. How do I correct this?