I would like to use D3.js (or maybe Raphaël) for backend-generated reports using XSL-FO with Java. These JavaScript libraries should be used for several reasons:
You could use phantom.js. It's a headless browser based on webkit, which allows you to run JavaScript without the need for a browser.
Using this you could just execute a system call to run phantom.js with for your JavaScript code and inputs. It would then create your output accordingly. See this example.