<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:360595559;
mso-list-type:hybrid;
mso-list-template-ids:-1136471928 -1 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style></head><body lang=EN-US link=blue vlink="#954F72"><div class=WordSection1><ol style='margin-top:0in' start=1 type=1><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'> We need to figure out if load() will work with items inside a jar. If not, we may have to put a lot of stuff in X3DJSAIL.</li><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>Require() can pull stuff out of the classpath, if programmed right. We should look into making sure we can load items from classpath in jvm-npm.js which implements require(). I may have removed that feature, not sure. Download a new version with $ npm install jvm-npm –save then copy jvm-npm.js out of node_modules.</li><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>Ideally, we can remove the script from java/build.xml and call X3DJSAIL directly. See following patch</li></ol><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>John</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>$ svn diff CreateX3dSceneAccessInterfaceJava.xslt</p><p class=MsoNormal>Index: CreateX3dSceneAccessInterfaceJava.xslt</p><p class=MsoNormal>===================================================================</p><p class=MsoNormal>--- CreateX3dSceneAccessInterfaceJava.xslt (revision 26074)</p><p class=MsoNormal>+++ CreateX3dSceneAccessInterfaceJava.xslt (working copy)</p><p class=MsoNormal>@@ -3736,7 +3736,7 @@</p><p class=MsoNormal> bufferedWriter = Files.newBufferedWriter(intermediateJSFilePath, charset);</p><p class=MsoNormal> String tmpStr = "load('nashorn/jvm-npm.js');\nload('nashorn/repeatPolyfill.js');\nvar xmldom = require('nashorn/node_modules/xmldom');\nvar DOMParser = xmldom.DOMParser;\nvar XMLSerializer = new xmldom.XMLSerializer();\nvar DOMImplementation = new xmldom.DOMImplementation();\n";</p><p class=MsoNormal> bufferedWriter.write(tmpStr, 0, tmpStr.length());</p><p class=MsoNormal>- tmpStr = "var json = "+outputSceneText+";\nvar version = json['X3D']['@version'];\nvar docType = DOMImplementation.createDocumentType('X3D', 'ISO//Web3D//DTD X3D '+version+'//EN', 'http://www.web3d.org/specifications/x3d-'+version+'.dtd', null);\nvar document = DOMImplementation.createDocument(null, 'X3D', docType);\nvar mapToMethod = require('nashorn/node/mapToMethod.js');\n var mapToMethod2 = require('nashorn/node/mapToMethod2.js');\n var fieldTypes = require('nashorn/node/fieldTypes.js');\n load('nashorn/node/X3DJSONLD.js');\n load('nashorn/node/JavaScriptSerializer.js');\n var child = CreateElement('X3D');\n ConvertToX3DOM(json, '', child, 'flipper.json');\n print('Returning with', child);\n var output = new JavaScriptSerializer().serializeToString(json, child, '"+outputFilePath+"', mapToMethod, fieldTypes);\n var FileWriter = Java.type('java.io.FileWriter');\n var fw = new FileWriter('"+fileName+"');\n fw.write(output);\n fw.close();\n";</p><p class=MsoNormal>+ tmpStr = "var json = "+outputSceneText+";\nvar version = json['X3D']['@version'];\nvar docType = DOMImplementation.createDocumentType('X3D', 'ISO//Web3D//DTD X3D '+version+'//EN', 'http://www.web3d.org/specifications/x3d-'+version+'.dtd', null);\nvar document = DOMImplementation.createDocument(null, 'X3D', docType);\nvar mapToMethod = require('nashorn/node/mapToMethod.js');\n var mapToMethod2 = require('nashorn/node/mapToMethod2.js');\n var fieldTypes = require('nashorn/node/fieldTypes.js');\n load('nashorn/node/X3DJSONLD.js');\n load('nashorn/node/JavaScriptSerializer.js');\n var child = CreateElement('X3D');\n ConvertToX3DOM(json, '', child, 'flipper.json');\n print('Returning with', child);\n var output = new JavaScriptSerializer().serializeToString(json, child, '"+fileName+"', mapToMethod, fieldTypes);\n var FileWriter = Java.type('java.io.FileWriter');\n var fw = new FileWriter('"+fileName+"');\n fw.write(output);\n fw.close();\n";</p><p class=MsoNormal> bufferedWriter.write(tmpStr, 0, tmpStr.length());</p><p class=MsoNormal> bufferedWriter.close(); // ensure file writing is complete</p><p class=MsoNormal> }</p><p class=MsoNormal>@@ -3745,10 +3745,9 @@</p><p class=MsoNormal> throw new X3DException("IOException when creating intermediateJSFileName " + intermediateJSFileName +</p><p class=MsoNormal> ", unable to save file: " + exception);</p><p class=MsoNormal> }</p><p class=MsoNormal>-/*</p><p class=MsoNormal> try {</p><p class=MsoNormal> ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");</p><p class=MsoNormal>- engine.eval("load('"+intermediateJSFilePath+"');");</p><p class=MsoNormal>+ engine.eval("load('"+intermediateJSFileName+"');");</p><p class=MsoNormal> if (ConfigurationProperties.isDeleteIntermediateFiles()) // clean up when done</p><p class=MsoNormal> intermediateJSFilePath.toFile().deleteOnExit();</p><p class=MsoNormal> engine.eval("print('Hello World!');");</p><p class=MsoNormal>@@ -3758,7 +3757,6 @@</p><p class=MsoNormal> throw new X3DException(errorNotice + "ScriptException when processing fileName " + intermediateJSFilePath +</p><p class=MsoNormal> ", unable to save result: " + exception);</p><p class=MsoNormal> }</p><p class=MsoNormal>-*/</p><p class=MsoNormal> return outputFilePath.toFile(); // success</p><p class=MsoNormal> }</p><p class=MsoNormal><o:p> </o:p></p></div></body></html>