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. Advertisements

  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. Advertisements

  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. Advertisements

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. Jon paugh
    Replies:
    1
    Views:
    1,365
  2. MS
    Replies:
    7
    Views:
    7,713
  3. R
    Replies:
    3
    Views:
    583
    Andrew Thompson
    May 30, 2005
  4. Replies:
    6
    Views:
    6,532
    Roedy Green
    Oct 13, 2005
  5. flyaflya
    Replies:
    2
    Views:
    436
  6. Just D.
    Replies:
    0
    Views:
    821
    Just D.
    Aug 11, 2004
  7. Ken Fine
    Replies:
    2
    Views:
    564
    Ken Fine
    Oct 26, 2004
  8. Edward Diener
    Replies:
    11
    Views:
    690
    Bart Van der Donck
    Oct 26, 2007
Loading...