[x3d-public] CLASSPATH not set in X3DJSAIL. Problems generating JSON from Nashorn

Don Brutzman brutzman at nps.edu
Fri Jan 26 02:01:44 PST 2018


glad to hear that it is yielding!  your approach looks to be consistent with the classpath guidance at

X3D Java Scene Access Interface Library (X3DJSAIL): Command Line
http://www.web3d.org/specifications/java/X3dJavaSceneAuthoringInterface.html#CommandLine

I will add CLASSPATH to that header for easier reference.  This also explains the lib jars.  Please advise if your solution is different or more is needed.

===============================================

     Setup CLASSPATH for repeated invocation using local libraries:
      
         Primary: CLASSPATH correctly containing "fat jar" X3DJSAIL.3.3.full.jar

         Example CLASSPATH confirmation:
         % echo $CLASSPATH
         CLASSPATH='C:\x3d-code\www.web3d.org\x3d\stylesheets\java\jars\X3DJSAIL.3.3.full.jar'

         Alternative: For developers, an alternative CLASSPATH configuration is "skinny jar" X3DJSAIL.3.3.classes.jar but note that Saxon stylesheet engine and other EXI .jar dependencies must also be provided.
         % echo $CLASSPATH
         CLASSPATH='C:\x3d-code\www.web3d.org\x3d\stylesheets\java\jars\X3DJSAIL.3.3.classes.jar;
         C:\x3d-code\www.web3d.org\x3d\stylesheets\java\lib\saxon9he.jar;
         C:\x3d-code\www.web3d.org\x3d\stylesheets\java\lib\exificient-gui-jar-with-dependencies.jar;
         C:\x3d-code\www.web3d.org\x3d\stylesheets\java\lib\nagasena.jar'

===============================================


On 1/26/2018 1:45 AM, John Carlson wrote:
> This works:
> 
> $ jjs -J-Djava.class.path=jars/X3DJSAIL.3.3.full.jar nashorn/examples/HelloWorldProgramOutput.Nashorn.js
> 
> Warning: nashorn/examples/HelloWorldProgramOutput.Nashorn.js.new.x3d does not meet suggested X3D naming conventions. Output serialization allowed to continue, file may be editable...
> 
> Warning: toFileX3D() is overwriting prior file nashorn/examples/HelloWorldProgramOutput.Nashorn.js.new.x3d
> 
> Warning: nashorn/examples/HelloWorldProgramOutput.Nashorn.js.new.json does not meet suggested X3D naming conventions. Output serialization allowed to continue, file may be editable...
> 
> Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
> 
> Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
> 
> Yay!
> 
> John
> 
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
> 
> *From: *John Carlson <mailto:yottzumm at gmail.com>
> *Sent: *Friday, January 26, 2018 4:11 AM
> *To: *x3d-public at web3d.org <mailto:x3d-public at web3d.org>; Don Brutzman <mailto:brutzman at nps.edu>
> *Subject: *CLASSPATH not set in X3DJSAIL. Problems generating JSON from Nashorn
> 
> Even though I set the classpath in x3d/stylesheets/java, it’s not picked up for some reason???  This is only when generating JSON. Hmm.
> 
> $ jjs -cp jars/X3DJSAIL.3.3.full.jar nashorn/examples/HelloWorldProgramOutput.Nashorn.js
> 
> Warning: nashorn/examples/HelloWorldProgramOutput.Nashorn.js.new.x3d does not meet suggested X3D naming conventions. Output serialization allowed to continue, file may be editable...
> 
> Warning: toFileX3D() is overwriting prior file nashorn/examples/HelloWorldProgramOutput.Nashorn.js.new.x3d
> 
> Warning: nashorn/examples/HelloWorldProgramOutput.Nashorn.js.new.json does not meet suggested X3D naming conventions. Output serialization allowed to continue, file may be editable...
> 
> Exception in thread "main" org.web3d.x3d.sai.InvalidFieldValueException: ERROR_CONFIGURATION_X3DJSAIL X3DJSAIL jar archive "" not found in CLASSPATH=
> 
>          at org.web3d.x3d.jsail.Core.X3DObject.toFileStylesheetConversion(X3DObject.java:1029)
> 
>          at org.web3d.x3d.jsail.Core.X3DObject.toFileStylesheetConversion(X3DObject.java:841)
> 
>          at org.web3d.x3d.jsail.Core.X3DObject.toFileJSON(X3DObject.java:1702)
> 
>          at jdk.scripting.nashorn.scripts/jdk.nashorn.internal.scripts.Script$Recompilation$609$HelloWorldProgramOutput_Nashorn$cu1$restOf.:program(nashorn/examples/HelloWorldProgramOutput.Nashorn.js:248)
> 
>          at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:652)
> 
>          at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:513)
> 
>          at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:517)
> 
>          at jdk.scripting.nashorn/jdk.nashorn.tools.Shell.apply(Shell.java:519)
> 
>          at jdk.scripting.nashorn/jdk.nashorn.tools.Shell.runScripts(Shell.java:448)
> 
>          at jdk.scripting.nashorn/jdk.nashorn.tools.Shell.run(Shell.java:186)
> 
>          at jdk.scripting.nashorn.shell/jdk.nashorn.tools.jjs.Main.main(Main.java:104)
> 
>          at jdk.scripting.nashorn.shell/jdk.nashorn.tools.jjs.Main.main(Main.java:80)
> 
> C:\x3d-code\www.web3d.org\x3d\stylesheets\java>jjs -cp jars\X3DJSAIL.3.3.classes.jar;lib\exificient-gui-jar-with-dependencies.jar;..\saxon9he.jar nashorn\examples\HelloWorldProgramOutput.Nashorn.js
> 
> Warning: nashorn/examples/HelloWorldProgramOutput.Nashorn.js.new.x3d does not meet suggested X3D naming conventions. Output serialization allowed to continue, file may be editable...
> 
> Warning: toFileX3D() is overwriting prior file nashorn/examples/HelloWorldProgramOutput.Nashorn.js.new.x3d
> 
> Warning: nashorn/examples/HelloWorldProgramOutput.Nashorn.js.new.json does not meet suggested X3D naming conventions. Output serialization allowed to continue, file may be editable...
> 
> Exception in thread "main" org.web3d.x3d.sai.InvalidFieldValueException: ERROR_CONFIGURATION_X3DJSAIL X3DJSAIL jar archive "" not found in CLASSPATH=
> 
>          at org.web3d.x3d.jsail.Core.X3DObject.toFileStylesheetConversion(X3DObject.java:1029)
> 
>          at org.web3d.x3d.jsail.Core.X3DObject.toFileStylesheetConversion(X3DObject.java:841)
> 
>          at org.web3d.x3d.jsail.Core.X3DObject.toFileJSON(X3DObject.java:1702)
> 
>          at jdk.scripting.nashorn.scripts/jdk.nashorn.internal.scripts.Script$Recompilation$609$HelloWorldProgramOutput_Nashorn$cu1$restOf.:program(nashorn\examples\HelloWorldProgramOutput.Nashorn.js:248)
> 
>          at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:652)
> 
>          at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:513)
> 
>          at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:517)
> 
>          at jdk.scripting.nashorn/jdk.nashorn.tools.Shell.apply(Shell.java:519)
> 
>          at jdk.scripting.nashorn/jdk.nashorn.tools.Shell.runScripts(Shell.java:448)
> 
>          at jdk.scripting.nashorn/jdk.nashorn.tools.Shell.run(Shell.java:186)
> 
>          at jdk.scripting.nashorn.shell/jdk.nashorn.tools.jjs.Main.main(Main.java:104)
> 
>          at jdk.scripting.nashorn.shell/jdk.nashorn.tools.jjs.Main.main(Main.java:80)
> 


all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman



More information about the x3d-public mailing list