Aren't you the same one that just said this?
I know that to use a compiler, you need a JDK
So enlighten us: do you know that, or don't you? You say you know it but your question implies that you don't.
Here are two links that may shed some light on this issue. I have them, but I did not play around with this for years, so I don't think I could answer further questions. I remember I could do this and there were some complications, as some SDK only jar has to be included.
Thank you baftos and rp0428:
baftos, both solutions need the JDK to compile files. I need to provide compilation using only JRE.
rp0428, the c# System.Reflection.Emit.DynamicMethod provides a way to construct source code using low-level byte code instructions, and then generate compiled code. This is a way to provide on-the-fly compilation. Is there an equivalent funtionality in java to makeup for not having the regular comiler in the JRE.
Is there an equivalent funtionality in java to makeup for not having the regular comiler in the JRE.
No - to compile you need a compiler. You don't need the whole JDK but the compiler is in the tools.jar that is part of the JDK.
Thank you rp0428
Just to be clear "System.Reflection.Emit.DynamicMethod" is used to construct a method (not class) using C# (CIL) byte code.
There is no equivalent to that in the standard API including the java compiler.
The java compiler compiles java into a java class. There are other, different, equivalents to that in C#.
There are third party libraries that allows one to create a java class using java byte codes. Those would be the closest approximation to the DynamicMethod.