Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 630 Bytes

File metadata and controls

18 lines (14 loc) · 630 Bytes

java-runtime-compiler

helps in compiling the java file at runtime

For compiling simple java code use below code

Class<?> cls = RuntimeCompiler.compile(sourceCodeString, "fullyqualifiedClassName");

// we can also specify file path
Class<?> cls = RuntimeCompiler.compile(Paths.get("filePath"), "fullyqualifiedClassName");

For compiling class that uses spring annotations or spring beans

Object obj = beanCompiler.compileAndGetSpringBean(sourceCodeString, "fullyqualifiedClassName");

//using file path
Object obj = beanCompiler.compileAndGetSpringBean(Paths.get("filePath"), "fullyqualifiedClassName");