I need to generate class at runtime, each class is mapped to a database table. Such class is model class used in ORM.
When client specify a database table to work w
Yes, this is possible. And you don't need an external lib. The JDK provides everything you need:
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
int compilationResult = compiler.run(null, null, null, fileToCompile);
if (compilationResult == 0) {
System.out.println("Compilation is successful");
} else {
System.out.println("Compilation Failed");
}
Check out the JavaCompiler docs.