See LiveConnect definition in the Mozilla Javascript guide for details of the Java/Javascript interface.
LiveConnect