[x3d-public] X3DJSAIL, fix final error in java/nashorn build

John Carlson yottzumm at gmail.com
Tue Jul 17 04:38:31 PDT 2018


You can take off the classpath: on the final diff and send the problem back to me, if you like.  However, I’d like to get the other fixes in place before I do that.



Sent from Mail for Windows 10

From: John Carlson
Sent: Tuesday, July 17, 2018 6:40 AM
To: Don Brutzman; X3D Graphics public mailing list
Subject: X3DJSAIL, fix final error in java/nashorn build

Don, can you try to fix this final problem with the java/nashoirn/build.xml test.nashorn build?  Thanks!

I discovered that you can use classpath: to load JavaScripts from the classpath in Nashorn, which fixed quite a few errors
     [java] org.web3d.x3d.sai.X3DException: ScriptException when processing fileName ..\nashorn\examples\HelloWorldProgramOutput.Nashorn.js.intermediate.js, unable to save result: javax.script.ScriptException: TypeError: Cannot load script from classpath:../nashorn/examples/HelloWorldProgramOutput.Nashorn.js.intermediate.js in <eval> at line number 1
     [java]     at org.web3d.x3d.jsail.Core.X3DObject.toFileJavaScript(X3DObject.java:1666)
     [java]     at org.web3d.x3d.jsail.CommandLine.run(CommandLine.java:628)
     [java]     at org.web3d.x3d.jsail.CommandLine.main(CommandLine.java:163)

Here is my current patch, I think the problem is with the last difff, but I don’t know how to fix it right:

svn diff CreateX3dSceneAccessInterfaceJava.xslt
Index: CreateX3dSceneAccessInterfaceJava.xslt
--- CreateX3dSceneAccessInterfaceJava.xslt      (revision 27088)
+++ CreateX3dSceneAccessInterfaceJava.xslt      (working copy)
@@ -3907,9 +3907,9 @@
                                        // patches by John Carlson
                     bufferedWriter = Files.newBufferedWriter(intermediateJSFilePath, charset);
                                        String nashornFolder = "nashorn";
-                                       String tmpStr = "load('"+nashornFolder+"/jvm-npm.js');\n";
+                                       String tmpStr = "load('classpath:"+nashornFolder+"/jvm-npm.js');\n";
                                        bufferedWriter.write(tmpStr, 0, tmpStr.length());
-                                       tmpStr = "load('"+nashornFolder+"/repeatPolyfill.js');\n";
+                                       tmpStr = "load('classpath:"+nashornFolder+"/repeatPolyfill.js');\n";
                                        bufferedWriter.write(tmpStr, 0, tmpStr.length());
                                        tmpStr = "var xmldom = require('"+nashornFolder+"/node_modules/xmldom');\n";
                                        bufferedWriter.write(tmpStr, 0, tmpStr.length());
@@ -3933,9 +3933,9 @@
                                        bufferedWriter.write(tmpStr, 0, tmpStr.length());
                                        tmpStr = "var fieldTypes = require('"+nashornFolder+"/node/fieldTypes.js');\n";
                                        bufferedWriter.write(tmpStr, 0, tmpStr.length());
-                                       tmpStr = "load('"+nashornFolder+"/node/X3DJSONLD.js');\n";
+                                       tmpStr = "load('classpath:"+nashornFolder+"/node/X3DJSONLD.js');\n";
                                        bufferedWriter.write(tmpStr, 0, tmpStr.length());
-                                       tmpStr = "load('"+nashornFolder+"/node/JavaScriptSerializer.js');\n";
+                                       tmpStr = "load('classpath:"+nashornFolder+"/node/JavaScriptSerializer.js');\n";
                                        bufferedWriter.write(tmpStr, 0, tmpStr.length());
                                        tmpStr = "var child = CreateElement('X3D');\n";
                                        bufferedWriter.write(tmpStr, 0, tmpStr.length());
@@ -3963,7 +3963,7 @@
                 try {
                                        ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
-                                        engine.eval("load('"+intermediateJSFileName+"');");
+                                        engine.eval("load('classpath:"+intermediateJSFileName+"');");
                                        if (ConfigurationProperties.isDeleteIntermediateFiles()) // clean up when done
                                        engine.eval("print('Hello World!');");

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20180717/5c488dc9/attachment-0001.html>

More information about the x3d-public mailing list