In a recent blog post announcing Blackberry Widgets the following was said about getting Java library functionality in a Blackberry Widget (emphasis added by me):
What if RIM doesn't provide me with the JavaScript API I am looking for?
RIM will continue to add new JavaScript APIs for BlackBerry Widgets. Most will not require new BlackBerry Device Software upgrades to be used. Java developers can also create their own custom JavaScript BlackBerry Widget Extension to be packaged with their widget.
They also go on to describe the architecture of a packaged widget with the following diagram:
How can I implement a "Linked JavaScript Extension" and use it in a Widget?