from a java application

T

tiewknvc9

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
 
C

Chris Smith

tiewknvc9 said:
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.

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
V

VisionSet

tiewknvc9 said:
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?
 
T

tiewknvc9

will it still be able to process form input? Im trying to get some
information from the user...
 
T

tiewknvc9

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?
 
V

VisionSet

tiewknvc9 said:
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
 
T

tiewknvc9

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?
 
I

IchBin

tiewknvc9 said:
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?
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-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,056
Members
48,769
Latest member
Clifft

Latest Threads

Top