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

yottzumm at gmail.com yottzumm at gmail.com
Fri Jul 20 07:32:29 PDT 2018


What’s important to realize is that I may only have a .class file, and I want to recover xml or JSON encoding. With your way of handling parameters, I have no way of doing that, afaict, without a decompiler.  Please correct me with an example invocation.

Sent from my iPhone

> On Jul 20, 2018, at 6:32 AM, Don Brutzman <brutzman at nps.edu> wrote:
> 
> 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.
> 
> http://www.web3d.org/specifications/java/X3DJSAIL.html#Downloads
> 
> 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