1

How can I get the .class of a javascript file? Rhino claims we can compile a javascript file and get the .class file of it. I have gone through their documentation but didn’t found such. Instead I have found that they use java objects from javascript.

Harshana
  • 7,297
  • 25
  • 99
  • 173
  • See http://stackoverflow.com/questions/3843996/how-to-compile-rhino-javascript-files-to-class-bytecode-for-java-at-runtime and http://stackoverflow.com/questions/231550/has-anyone-used-or-written-an-ant-task-to-compile-rhino-javascript-to-java-byt/ – geca Dec 05 '11 at 11:16
  • @Harshana - you have to be aware that in rare cases you may enounter an issue with compiling javascripts to `.class` due to [the bytecode size limit](http://coachwei.sys-con.com/node/676073/) imposed by the JVM, thouht I think it will be rare, more likely if you compile very large code like [coffeescript](https://github.com/jashkenas/coffee-script/blob/master/extras/coffee-script.js) – OnesimusUnbound Dec 05 '11 at 11:25

1 Answers1

2

There you go: Rhino Project - JavaScript Compiler

bezmax
  • 25,562
  • 10
  • 53
  • 84