I have a String which contains the source code of an entire java class. My intention is to create a new class in another project folder using the code in this String. All this is to be done by code, not manually.
Is this possible in Java?
I have a String which contains the source code of an entire java class. My intention is to create a new class in another project folder using the code in this String. All this is to be done by code, not manually.
Is this possible in Java?
Since you are using String
, I'm assuming you are talking about a class in Java source code form. If you are targeting JRE 1.6 or higher, you can use the JavaCompiler
interface for turning this source code into a compiled Java class.