How to insert java file inside code in Java
There are no directives in Java at source compile time.
Also it has no rating for evaluating Java source code at runtime.
The only real way to get new Java code in an executable Java virtual machine is by loading classes.
However, since the advent of javax.script (Java 6), a reasonably supported runtime environment (like Java 8's Nashorn Javascript implementation) can import and evaluate some script code that is fed back into the Java API. This is a huge question and too big to study in depth here.
source to share
Java has no equivalent eval
or any other construct capable of evaluating code at runtime. It is excellently capable of parsing external data such as XML and taking action on what it finds. It can also run and dump output from external processes, which could very well be dynamically generated code. The details of this process depend on your OS.
source to share