Package net.janino.Java

Examples of net.janino.Java.CompilationUnit.compile()


    public byte[] compile( String name, String source) throws Exception {
      // using janino embeddable compiller
      Parser p = new Parser( new Scanner( name, new StringReader( source)));
      CompilationUnit cu = p.parseCompilationUnit();
      IClassLoader cl = new ClassLoaderIClassLoader( new URLClassLoader( new URL[] {}));
      return cu.compile( cl, 0)[0].toByteArray();
    }
 
  }
 
}
View Full Code Here


   
    IClassLoader cl = new ClassLoaderIClassLoader( new URLClassLoader( new URL[] {}));

    Parser p = new Parser( new Scanner( "JPEGImageWriterDump", new StringReader( code)));
    CompilationUnit cu = p.parseCompilationUnit();
    cu.compile( cl, DebuggingInformation.NONE)[0].toByteArray();
   
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.