I had pretty much the same requirement for my application, and I implemented it with a Comet communication.
Basically your JavaScript should connect to a generated channel per user, and listen to messages on it. Then your Java application, once launched, should open a connection to this channel and broadcast a "I'm ready" message, that the JavaScript application will receive, and then act accordingly.
Good luck, it's not that easy :) More details on http://cometd.org/