open url WITH PARAMETERS in default browser

Discussion in 'Java' started by epicwinter@hotmail.com, Oct 9, 2005.

  1. Guest

    I am trying to automatically open a url from the default browser from a
    java application. I can open a url in the browser no problem. I have
    looked at the commonly sited articles here:
    http://dmoz.org/Bookmarks/D/deadsea/Java_Help/Web_Browser/

    For windows xp I use this command:
    commandArgs = new String[3];
    commandArgs[0] = "cmd.exe";
    commandArgs[1] = "/C";
    commandArgs[2] = absoluteFileName;
    Runtime.getRuntime().exec(commandArgs);

    If I am trying to open c:\myhtmlfile.html it works great.
    But when I try to open it c:\myhtmlfile.html?parameter1=ABCD
    It does not work. I have tried every possible way to do this and the
    closest I get it to working is it just opens the page without the
    parameter. I can not figure out how to open it with a parameter.

    Please advise, thanks
    -ryan
     
    , Oct 9, 2005
    #1
    1. Advertising

  2. wrote:
    > I am trying to automatically open a url from the default browser from a
    > java application.

    ...
    > http://dmoz.org/Bookmarks/D/deadsea/Java_Help/Web_Browser/
    >
    > For windows xp I use this command:


    BrowserLauncher (also listed at the above page) also
    covers *nix and Mac. AFAIR.
     
    Andrew Thompson, Oct 10, 2005
    #2
    1. Advertising

  3. Guest

    You aren't reading my question. This all works fine for normal urls
    but not one with parameters!
     
    , Oct 10, 2005
    #3
  4. On Mon, 10 Oct 2005 09:47:50 -0700, epicwinter wrote:

    > You aren't reading my question. This all works fine for normal urls
    > but not one with parameters!


    Well, look at it this way: Who would interpret the parameter anyway? If it
    is a file on the local file system, there is no webserver to use these
    parameters in any way. ;)

    --
    You can't run away forever,
    But there's nothing wrong with getting a good head start.
    --- Jim Steinman, "Rock and Roll Dreams Come Through"
     
    Stefan Schulz, Oct 11, 2005
    #4
  5. Guest

    The html file contains a reference to a flash file which accepts the
    paramters through javascript.
     
    , Oct 12, 2005
    #5
  6. wrote:

    > You aren't reading my question. This all works fine for normal urls
    > but not one with parameters!


    ?

    Your subject states..
    > open url WITH PARAMETERS in default browser


    Your first attempt noted..

    > For windows xp I use this command:


    Now, pause for a moment, and let this sink in,
    - BrowserLauncher works cross-platform
    - You can load URL's with parameters using BrowserLauncher

    Here is the proof. I have a little program called
    JVMClean. It is made to remove the MSVM from IE,
    but it uses BrowserLauncher to connect back to
    my site with 'bug reports'.

    Just to check that everything still works after a recent
    site move, I just downlaoded and launched JVMClean again.
    You can find it here.
    <http://www.physci.org/jvmclean.jsp?pt=download>

    When you first load it, it shows a Dialog with
    'further help/notes', it mentions
    F12 - Report a bug ( ..tough if you're not on Windows ;)

    Dismiss the dialog and press the F12 key to see
    BrowserLauncher go to my site using an URL with
    parameters. Which brings me back to..

    The solution I quoted is not only known to work for
    parameters, but X-plat. What more do you want?

    As far as why your code is failing, I am not sure.

    If you are really *determined* to get this working by
    calling Runtime.exec() (e.g. as an exercise in
    understanding Runtime.exec()) I suggest you post a
    short, complete example[1] of what you are doing.
    *Short* compilable code that displays the problem
    is more likely to get the close attetnion of some
    people in the group.
    [1] <http://www.physci.org/codes/sscce.jsp>

    HTH
     
    Andrew Thompson, Oct 12, 2005
    #6
  7. Roedy Green Guest

    On 10 Oct 2005 09:47:50 -0700, wrote or quoted
    :

    >You aren't reading my question. This all works fine for normal urls
    >but not one with parameters!


    Parameters are encoded into the URL for get. Perhaps you are used to
    having something construct the URL for you. You will have to do it
    manually. It will look something like this:

    http://mega.com/search?country=ca&city=Victoria

    see http://mindprod.com/jgloss/urlencoded.html
    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Again taking new Java programming contracts.
     
    Roedy Green, Oct 13, 2005
    #7
    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. Jon paugh
    Replies:
    1
    Views:
    881
  2. anonymous
    Replies:
    1
    Views:
    4,637
    Francisco Padron
    May 8, 2005
  3. Gaurav  Agarwal
    Replies:
    2
    Views:
    757
    Gaurav Agarwal
    Jan 31, 2005
  4. flyaflya
    Replies:
    2
    Views:
    385
  5. desktop
    Replies:
    2
    Views:
    475
    Victor Bazarov
    Jun 6, 2007
Loading...

Share This Page