Package org.abstractmeta.toolbox.compilation.compiler

Examples of org.abstractmeta.toolbox.compilation.compiler.JavaSourceCompiler.compile()


            for(; ci<codev.length; ci++)
              javaSourceCode.append(codev[ci]);   
       
            compilationUnit.addJavaSource(pname+"."+cname, javaSourceCode.toString());
            try {
              javaSourceCompiler.compile(compilationUnit);
              javaSourceCompiler.persistCompiledClasses(compilationUnit);
              j.outputObject.finished(null);
            } catch(Exception e) { j.outputObject.error("ERROR:\n"+e.toString()); }   
          } else {
            String ret = "void";
View Full Code Here


            javaSourceCode.append("}\n");
       
            compilationUnit.addJavaSource(pname+".Foo", javaSourceCode.toString());
 
            loader.clearCache();
            javaSourceCompiler.compile(compilationUnit);
            javaSourceCompiler.persistCompiledClasses(compilationUnit);
            Class<?> fooClass = loader.loadClass(pname+".Foo");
            Method mth = fooClass.getDeclaredMethod("beakerRun", (Class[]) null);
            Object o = mth.invoke(null, (Object[])null);
            if(ret.equals("Object")) {
View Full Code Here

                    JavaSourceCompiler.CompilationUnit compilationUnit = javaSourceCompiler.createCompilationUnit();
                    if (!dependencies.isEmpty()) compilationUnit.addClassPathEntries(dependencies);

                    try {
                        compilationUnit.addJavaSource(fileName.replace(".java", ""), readFile(f.getAbsolutePath()));
                        ClassLoader classLoader = javaSourceCompiler.compile(compilationUnit);
                        Class<dExternal> load = (Class<dExternal>) classLoader.loadClass(fileName.replace(".java", ""));
                        dExternal loadedClass = load.newInstance();
                        loadedClass.load();
                        loadedExternals.add(loadedClass);
                    } catch (Exception e) {
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.