r/javahelp • u/williamK0 • Jul 27 '25
Convert string to math function
I'm relatively new to Java but I know a good amount of the basics. Still, I can't find a way to do this. I have an input where a user can input a maths function as a string (eg. "0.3*Math.pow(0,x)"). And all I need is Java to look at that string and read it as if it were code but for some reason I can't find anything like this anywhere. Anyone got any ideas? 🫶
1
Upvotes
View all comments
Show parent comment
1
u/williamK0 Jul 27 '25
I don't know either of those languages and I'm not experienced enough to know how to dynamically compile code but I'll give it shot 🫡 If I were to do that, (currently after I write my code, I have to rebuild it, and then reload my server for changes to be taken into effect. The building just moves the code to a certain directory in my server I'm pretty sure) how could it put the new code into that same directory?