Convert .java to .class within a java program -
this question has answer here: how can compile , deploy java class @ runtime? 7 answers i have several .java files created during runtime. want use created .java files classes in program. how may this, without starting program second time ? want compile .java files during runtime , use new .class files on... use java compiler api: public class simplecompiletest { public static void main(string[] args) { string filetocompile = "test" + java.io.file.separator +"myclass.java"; javacompiler compiler = toolprovider.getsystemjavacompiler(); int compilationresult = compiler.run(null, null, null, filetocompile); if(compilationresult == 0){ system.out.println("compilation successful"); }else{ system.out.println("compilation failed"); }...