How do I open a Website/HTML file from an Application in a Browser (IE is fine)

Discussion in 'Java' started by Flo, Jan 9, 2007.

  1. Flo

    Flo Guest

    Hey guys,
    very basic question:
    I want to push a button, and open an HTML file in Internet Explorer (or
    any browser, there's no need for very compatible code, since the
    software will only be used a couple of times on a windows machine).

    Important: I do NOT want to have the HTML file viewed with java or
    JEditPane or whatever..

    Thank you!
    Flo.
     
    Flo, Jan 9, 2007
    #1
    1. Advertising

  2. Flo

    Real Gagnon Guest

    > Hey guys,
    > very basic question:
    > I want to push a button, and open an HTML file in Internet Explorer (or
    > any browser, there's no need for very compatible code, since the
    > software will only be used a couple of times on a windows machine).
    >
    > Important: I do NOT want to have the HTML file viewed with java or
    > JEditPane or whatever..


    JDK1.6 has java.awt.Desktop.open(File)

    or you can runtime.exec() your browser with something like

    Runtime.getRuntime().exec
    ("rundll32 url.dll,FileProtocolHandler " + theUrl);

    Also check http://www.rgagnon.com/javadetails/java-0071.html
    for more infos.

    bye.
    --
    Real Gagnon from Quebec, Canada
    * Looking for Java or PB code examples ? Visit Real's How-to
    * http://www.rgagnon.com/howto.html
     
    Real Gagnon, Jan 9, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page