> I have a simple JEditorPane that displays a very simple web page that
> has an embedded "mailto:foo@bar.com" [...] I can get the link text
> when the user clicks on the mailto link, but I'm having trouble
> invoking the native email program a la the typical browser.
I believe you should let the platform handle URL just like if it was a
http URL, so in an applet you would invoke
java.applet.AppletContext.showDocument,
in a WebStart application you would invoke
javax.jnlp.BasicService.showDocument, and in a stand-alone application
you would (still unfortunately, I believe) have to invoke some
platform-specific
command via java.lang.Runtime.exec in order to get the platform to
handle the URL. On Windows that would be something like "cmd.exe /c
start description mailto:foo@bar.com".
Regards,

Signature
Filip Larsen
Andrew Thompson - 26 Feb 2007 12:15 GMT
..
> > ...having trouble
> > invoking the native email program a la the typical browser.
>
> I believe you should let the platform handle URL just like if it was a
> http URL, so in an applet you would invoke
> java.applet.AppletContext.showDocument,
Unfortunately, showDocument() was never
reliable, and becomes less so as time
goes by.
> in a WebStart application you would invoke
> javax.jnlp.BasicService.showDocument,
Which at least returns a true/false to
indicate success/failure. It is the
method I prefer to use (easy to do, when
most of my apps. are web start based!).
>..and in a stand-alone application
> you would (still unfortunately, I believe) have to invoke some
> platform-specific
> command via java.lang.Runtime.exec in order to get the platform to
> handle the URL. On Windows that would be something like "cmd.exe /c
> start description mailto:f...@bar.com".
For that (or a signed applet) I would
look to BrowserLauncher2, which takes a
rigorous approach to finding and launching
the (hopefully) default browser.
Andrew T.