Package org.tempuri.javacImpl.util

Examples of org.tempuri.javacImpl.util.MemoryClassFactoryImpl$SourceReaderImpl


            "   public void run() {" +
            "       Hello hello = new Hello();" +
            "       System.out.println(hello.greeting());" +
            "   }" +
            "}";
        MemoryClassFactory factory = new MemoryClassFactoryImpl();
        Map sourceMap = new HashMap();
        sourceMap.put("test.Hello", helloSource);
        sourceMap.put("test.main.Main", mainSource);
        factory.setInput(sourceMap);
        JavaCompiler compiler = new JavaCompilerImpl();
        compiler.compile(new String[] {"test.main.Main"},
                         factory,
                         factory,
                         factory,
                         new JavaCompilerErrorHandler() {
                                 public void handleError(String className,
                                                         int line,
                                                         int column,
                                                         Object errorMessage) {
                                     String msg = className;
                                     if (line > 0) {
                                         msg += ": Line " + line;
                                     }
                                     if (column >= 0) {
                                         msg += "." + column;
                                     }
                                     msg += ": ";
                                     msg += errorMessage;
                                     System.err.println(msg);
                                 }
                             });
       
        Class clazz = factory.loadClass("test.main.Main");
        Runnable runner = (Runnable)clazz.newInstance();
        runner.run();
    }
View Full Code Here

TOP

Related Classes of org.tempuri.javacImpl.util.MemoryClassFactoryImpl$SourceReaderImpl

Copyright © 2018 www.massapicom. 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.