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 / May 2006

Tip: Looking for answers? Try searching our database.

from a java application

Thread view: 
tiewknvc9 - 21 May 2006 16:37 GMT
from a java application, how can I open (or redirect) a web browser to
a specific URL?

I want to direct my user from a menu item in the application to a help
file on the net...

Thanks
Chris Smith - 21 May 2006 17:15 GMT
> from a java application, how can I open (or redirect) a web browser to
> a specific URL?
>
> I want to direct my user from a menu item in the application to a help
> file on the net...

At least for now, you have to just know the name of the executable for
the browser and run it.  There's some talk of changing that, and it may
be changed in the Mustang betas.  Maybe you could check that out.

Signature

www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

VisionSet - 21 May 2006 17:42 GMT
> from a java application, how can I open (or redirect) a web browser to
> a specific URL?
>
> I want to direct my user from a menu item in the application to a help
> file on the net...

If you do that, you lose platform independence.  Why not use a
javax.swing.JEditorPane which can be easily configured as a mini browser,
and load your url in to that?

--
Mike W
tiewknvc9 - 21 May 2006 19:01 GMT
will it still be able to process form input?  Im trying to get some
information from the user...
VisionSet - 21 May 2006 19:29 GMT
> will it still be able to process form input?  Im trying to get some
> information from the user...

Not sure, possibly not.
Have a go, there is source here
<http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html#
editorpane>

--
Mike W
tiewknvc9 - 21 May 2006 20:06 GMT
doesnt seem like it....

well I tried to simply insert a <html><a href=\"mypage.htm\">test
text</a></html> into a messagebox, seeing how message boxes accept
html, but I cant even get the hyperlink to open up a browser, it doesnt
even recognize it as a link.

Im trying to find a solution of some sort, but it does seem like i
would need the user to copy and paste the address into their browser, a
step that I really dont want them to have to take, because I think they
just wont do it...

any ideas for me?
VisionSet - 21 May 2006 20:10 GMT
> doesnt seem like it....
>
> well I tried to simply insert a <html><a href=\"mypage.htm\">test
> text</a></html> into a messagebox, seeing how message boxes accept
> html, but I cant even get the hyperlink to open up a browser, it doesnt
> even recognize it as a link.

You have to do some extra stuff to make it follow links.
It is quite straightforward and there is code example in JEditorPane API
docs

--
Mike W
tiewknvc9 - 21 May 2006 20:19 GMT
I believe that the JEditorPane API explains how to get hyperlinks to
open within the JEditorPane (I read the documentation earlier), only
since the submit button still wont function the way I want it to, I was
hoping that there way some other way to get the real OS to handle a web
link.... and open it in another better created browser?
IchBin - 21 May 2006 20:52 GMT
> doesnt seem like it....
>
[quoted text clipped - 9 lines]
>
> any ideas for me?

If you are using JDK 1.6 you can now call the default machine browser
and pass the url you want to load via Net Class. I do not have the
commands in front of me. It is only takes two or three net commands.

You can use a program called 'BrowserLauncher'. The current
version is called 'BrowserLauncher2'.
http://browserlaunch2.sourceforge.net/docs.shtml#files

I have used BrowserLauncher in the past and you just need to add the
following to call it:

try {           
BrowserLauncher.openURL("http://browserlaunch2.sourceforge.net/index.shtml");
} catch (IOException e) {
  Error.errorMessage(e);
}

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)


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.