Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2005

Tip: Looking for answers? Try searching our database.

open url WITH PARAMETERS in default browser

Thread view: 
epicwinter@hotmail.com - 09 Oct 2005 20:38 GMT
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
Andrew Thompson - 10 Oct 2005 09:53 GMT
> 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.
epicwinter@hotmail.com - 10 Oct 2005 17:47 GMT
You aren't reading my question.  This all works fine for normal urls
but not one with parameters!
Stefan Schulz - 11 Oct 2005 19:57 GMT
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. ;)

Signature

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"
         

epicwinter@hotmail.com - 12 Oct 2005 21:22 GMT
The html file contains a reference to a flash file which accepts the
paramters through javascript.
Andrew Thompson - 12 Oct 2005 22:48 GMT
> 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
Roedy Green - 13 Oct 2005 03:40 GMT
On 10 Oct 2005 09:47:50 -0700, epicwinter@hotmail.com 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
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.