Hi, On Thu, 4 Oct 2001, Deacon Marcus wrote:
> There would be two classes, CompileUnit and CompileContext. > First, you create a CompileContext, initialize it with working dir and > classpath, then you create CompileUnit, initialize it with CompileContext > and a .java file. Then, you can call .prepare() or .compile() to compile the > file, and .newInstance() to create an instance or .getClass() to get Class. > Or you could use Class.forName(), since in most cases CompileContext's > classpath would be active classpath. so you're talking about generating java source code, and compiling it on the fly? > I'm sure you see the similarity to .JSP now. if my interpretation is correct, yes (o: > While it may seem basic, having API for this wouldn't hurt. > Possible scenario: > Supponse, there's some kind of mail server with *extremely* complicated > rule-set in form of 200kb+ xml. Why not take it, convert it into .java > implementing some interface, convert it to java source with hundreds if not > more ifs and cases, and load it as compiled code. > What I need: since JDK 1.4b2, tools.jar just isn't what it used to be... so > I need some kind of 100% java java compiler. And, I have no idea where to > search for one. Of course, there's dozens, but it must be both stable and > compatible with JDK 1.1 - 1.4. Short of searching google, which I'm sure you're already doing I cant help you there. What I can suggest though, is for source code generation, a project called Jenesis (http://www.inxar.org) which provides a nice API based on the Java Language spec. cheers dim