Where and how are you getting the reference from? What kind of
architecture are you prposing? Is this a servlet model or a standalone
on a desktop model?
Another option I thought of involves a bridge between an Applet and
Javascript. Not sure if this bridge is still available, but I used it
about 2 years ago. If this is the case, Javascript can do all the work
and report to an Applet that will talk to your application.