Opening default browser with dynamic URL

Discussion in 'Java' started by Josh, Jul 19, 2003.

  1. Josh

    Josh Guest

    In my Java app, I would like to open some help files in the user's
    default browser when they click a Help button. I found lots of
    examples using this type of call:

    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler
    file://wherever/help.html");

    (Substitute the real file path for "wherever")

    But my problem is that I'm using a dynamic help system where the URL
    that I am supposed to put into a browser to reach a given help file is
    of this form:

    file://wherever/index.htm?chapter=test&topic=help1

    If I use that URL string in the call to Runtime.exec(), I get an error
    message titled "Problem with Shortcut", saying "Unable to open file
    ""file://wherever/index.htm?chapter=test&topic=help1"".

    It opens correctly if I remove the tag stuff at the end and just open:

    file://wherever/index.htm

    Any ideas on how I can do this?
    Josh, Jul 19, 2003
    #1
    1. Advertising

  2. Josh

    Josh Guest

    Nobody's come across this problem before?

    Well, is there any way to retrieve the path to the user's default
    browser? Then I could directly run the browser with the dynamic
    help, which seems to work (Runtime.exec("C:\Program Files\Internet
    Explorer\iexplore.exe",
    "file://wherever/index.htm?chapter=test&topic=help1"); opens
    correctly).

    (Josh) wrote in message news:<>...
    > In my Java app, I would like to open some help files in the user's
    > default browser when they click a Help button. I found lots of
    > examples using this type of call:
    >
    > Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler
    > file://wherever/help.html");
    >
    > (Substitute the real file path for "wherever")
    >
    > But my problem is that I'm using a dynamic help system where the URL
    > that I am supposed to put into a browser to reach a given help file is
    > of this form:
    >
    > file://wherever/index.htm?chapter=test&topic=help1
    >
    > If I use that URL string in the call to Runtime.exec(), I get an error
    > message titled "Problem with Shortcut", saying "Unable to open file
    > ""file://wherever/index.htm?chapter=test&topic=help1"".
    >
    > It opens correctly if I remove the tag stuff at the end and just open:
    >
    > file://wherever/index.htm
    >
    > Any ideas on how I can do this?
    Josh, Jul 21, 2003
    #2
    1. Advertising

  3. Josh

    Andy Flowers Guest

    Try looking at
    http://www.javaworld.com/javaworld/javatips/jw-javatip66.html. It may help.

    "Josh" <> wrote in message
    news:...
    > In my Java app, I would like to open some help files in the user's
    > default browser when they click a Help button. I found lots of
    > examples using this type of call:
    >
    > Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler
    > file://wherever/help.html");
    >
    > (Substitute the real file path for "wherever")
    >
    > But my problem is that I'm using a dynamic help system where the URL
    > that I am supposed to put into a browser to reach a given help file is
    > of this form:
    >
    > file://wherever/index.htm?chapter=test&topic=help1
    >
    > If I use that URL string in the call to Runtime.exec(), I get an error
    > message titled "Problem with Shortcut", saying "Unable to open file
    > ""file://wherever/index.htm?chapter=test&topic=help1"".
    >
    > It opens correctly if I remove the tag stuff at the end and just open:
    >
    > file://wherever/index.htm
    >
    > Any ideas on how I can do this?
    Andy Flowers, Jul 21, 2003
    #3
    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.
Similar Threads
  1. MS
    Replies:
    7
    Views:
    7,358
  2. R
    Replies:
    3
    Views:
    498
    Andrew Thompson
    May 30, 2005
  3. Replies:
    6
    Views:
    6,185
    Roedy Green
    Oct 13, 2005
  4. flyaflya
    Replies:
    2
    Views:
    371
  5. Ken Fine
    Replies:
    2
    Views:
    415
    Ken Fine
    Oct 26, 2004
Loading...

Share This Page