I am attempting to create an application(game) that would use java to operate the physics,logic, etc. but would use existing javascript libraries for doing things like scripting, graphics, and the ui, but when loading a chart.js(and other libraries) through nashorn nashorn.eval("load('chart.js')");
I get the following (or similar for other libraries)
Exception in thread "main" javax.script.ScriptException: ReferenceError: "window" is not defined in chart.js at line number 668
.
Is it possible to use these libraries as-is, or would any modification by necessary, and how could I display scripts in a java application(or is it even possible, with or without nashorn)?
Thanks.
You may, however, be able to persuade this to run in the JavaFX WebView container. I have not tried using advanced JavaScript libraries in the container but my experience is:
URL.setURLStreamHandlerFactory
method).