I see only few reasons for creating class files instead of source code files. Actually this are the same reasons why you would ever need to create bytecode by hand in any situation.
- You absolutly need control over the bytecode (maybe for 'optimization' or testing purposes)
- You need to use features that are available in bytcode but not in the Java language
I think you rarely need to do any of the above. If this is really what you want to do, you should know a lot about the format of class files and bytecode of course. You would basically be creating some kind of compiler at this point.
You could argue that by shipping precompiled classes, or by generating bytcode directly, you can skip a step in the built process and the user's program will compiler faster. That may be true true but I'm sure the speed will be neglectable. It would be easier to just work with source code and pass it to the filer for compilation.
Should i use a dynamic compiler to compile this source in string to create the class?
No, I see no advantage here. If you create a source code file with the filer it will be compiled automatically. You only need to do this if your source code is not Java but some other language that you want to compile for the JVM.