Subj : Re: jsc feature request To : Andy Madigan From : Igor Bukanov Date : Wed Aug 25 2004 11:53 pm Andy Madigan wrote: > This has probably been requested before, but I though since I found a > way to do it, I'd ask anyway. > > What I would like to be able to do is specify what class/method should > be called by the main method in a class generated by jsc. The current > version of Codegen puts in a call to OptRuntime.main(Script,String[]). > However, if line 501 of Codegen.java was changed to instead get a > parameter (e.g. getScriptRuntimeClassName()) from it's CompilerEnv. The > class would of course have to have a method matching this signature: > > public static void main(Script,String[]) > > and generateMain() in Codegen (starting @ line 487) would have to be > made non-static (that change doesn't break anything during compile). > > A parameter could be added to jsc (e.g. "-runtime") that would allow > the user to specify the class containing the above method. > > I've already made the above changes to my version of the sources, if > this seems like a good idea, I can send my changed versions to whoever > is interested. You can file a bug at bugzilla.mozilla.org against Rhino, mark it as enhacment and add the patch there. But note that to set the class name you need to add the method to ClassCompiler which provides public API for class compilation used by jsc, and not CompilerEnvirons which is shared by interpreter and compiler and should not have any compiler-specific methods. Regards, Igor .