I want to know if there is any way to convert a String
to Java compilable code.
I have a comparative expression saved in a database field. I want to re
If you're willing to sacrifice the "Java code" portion of your requirement, you could use the Java Mathematic Expression Evaluator library. It allows you to specify a math expression (as a java.lang.String), add values for the variables, and then evaluate the expression.
I've used it in production code with great success.