Googling "javascript inside java" came up with a few promising results. Perhaps that's a good place to start?