Launch jsdom from Rhino on Java

前端 未结 2 1948
醉话见心
醉话见心 2021-01-15 05:01

I\'m following up on this answer:

I managed to run simple JavaScript code from Rhino Engine on Java.

But when it comes to D3.js, for example:

相关标签:
2条回答
  • 2021-01-15 05:35

    JsDom might be a bad option since it relies on so many internal features of Node and Google's V8 JavaScript engine. Env.JS should be a better option but if it doesn't work then you're probably out of luck. It might not work because it's essentially a frozen project with last release in 2010. You'll have to either run your JavaScript in Node or Phantom, or generate SVG with Java-based solutions like Apache Batik.

    By the way require in JsDom is not the same as require.js but a build-in Node.js function.

    0 讨论(0)
  • 2021-01-15 05:38

    Another approach would be using Domino as a DOM environment. Look here (http://jazdw.net/content/server-side-svg-generation-using-d3js) for details. Reading comments section would be also helpful

    0 讨论(0)
提交回复
热议问题