[x3d-public] X3DJSAIL running generated Java program to produce Java

Don Brutzman brutzman at nps.edu
Fri Jul 20 03:32:13 PDT 2018

Thanks for the report.

First I think that your jar is likely out of date, the diagnostics are familiar from the past but do not match current configuration.


Second, the error is trying to tell you that the file "HelloWorldProgramOutput" is not found.

I get the following:

[Error]  [org.web3d.x3d.jsail.CommandLine] file not found: HelloWorldProgramOutput
Usage: java [-classpath X3DJSAIL.*.jar] org.web3d.x3d.jsail.CommandLine [sourceModel.x3d | package.path.ProgramName | -help | -page | -resources | -tooltips]
        [-tofile [resultFile.*]] [-properties [propertiesFile]] [-validate]
        [sourceModel.exi -fromEXI] [sourceModel.gz -fromGZIP] [sourceModel.zip -fromZIP]
        [-toX3D | -toXML | -toHTML | -toMarkdown | -toTidy | -toClassicVrml | -toJava | -toJSON | -toVRML97 | -toX3DOM | -toX_ITE | -toEXI | -toGZIP | -toZIP]

Which likely makes sense for your system too, since the examples/ directory does not have any file "HelloWorldProgramOutput" except for those with a file extension added.

Incidentally to facilitate such testing using IDE debug mode, I added a utility method CommandLine.run(String arguments) which will accept a single string and split it into args.  Example use is now in HelloWorld.java main method, adapted here:

   // Quick test of CommandLine capability to facilitate debugging:
   org.web3d.x3d.jsail.CommandLine.run("HelloWorldProgramOutput  -tofile foo.java -toJava"); // allows simple testing

On 7/17/2018 6:51 PM, John Carlson wrote:
> Trying to produce Java source code from Java class, not working ,please advise:
> coderextreme at DESKTOP-DOPK2VD MINGW64 /c/x3d-code/www.web3d.org/x3d/stylesheets/java/classes
> $ java -cp ../jars/X3DJSAIL.3.3.full.jar";." HelloWorldProgramOutput -tofile foo.java -toJava
> parameter: "-tofile" "foo.java" for result file name root foo
> parameter: "-toJava" for conversion to Java source code
> [Error] Source model file name is empty, therefore file loading not possible.
> Java program "HelloWorldProgramOutput" self-validation test results: success
> coderextreme at DESKTOP-DOPK2VD MINGW64 /c/x3d-code/www.web3d.org/x3d/stylesheets/java/classes
> $ java -cp ../jars/X3DJSAIL.3.3.full.jar";." HelloWorldProgramOutput ../examples/HelloWorldProgramOutput.x3d -tofile foo.java -toJava
> WARNING: "HelloWorldProgramOutput" model invocation is attempting to load file "../examples/HelloWorldProgramOutput.x3d" instead of simply validating itself...
> No, CommandLine is not the correct answer.

actually yes I think precise CommandLine invocation was the answer.  given that your invocation was different than mine, you might have also been getting Java treating "HelloWorldProgramOutput" as an executable referrence.  Whatever - recommend omitting "HelloWorldProgramOutput" above and getting switches correct.

> Are we trying to provide a secure mechanism for people to write code so you can’t get the X3D XML or Java source code back out?    What about decompilers?
nope, no hidden protections.  CommandLine source shows that most of the code is simply trying to parse arguments correctly.

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