1 Reply Latest reply on Oct 28, 2005 11:25 AM by Shigeru Chiba

    Create class from source in memory

    Todd O'Bryan Newbie

      I've hunted through the Javassist API, but I can't find what I think is something it should be able to do.

      I'd like to read in a .java file and create a class in memory without writing out a .class file. Unfortunately, com.sun.tools.javac.Main doesn't seem to have a way to output the bytecode to anything other than a file in the filesystem. And CtClass doesn't seem to have a constructor that accepts a source code stream rather than a stream of bytecodes.

      Is this possible with Javassist? If not, any other ideas how I might go about it?