Help me out /g/
Java: How can I turn a string into a java runnable?
You mean like turning source code in the form of a string into bytecode during runtime?
There are libraries out there to do that, but there is almost a certainty that there is a better way to approach whatever problem you are trying to solve.
Factory pattern.RunnableFactory.get(string name)
if(name.equals("some string")) {
return new SomeRunnable();
}
>>56361328
>There are libraries out there to do that, but there is almost a certainty that there is a better way to approach whatever problem you are trying to solve.
I hate fuckers like you. Your entire post was worthless. Answer the guys question, ask for clarification, or don't even bother.
>>56361282
Just write a program that does the following:
1.writes the string to a file
2.executes command / bash javac command
3.there you go senpai, you are stupid. Thank me later.
I know there is a better way of doing the task. I just wanted to be able to go and grab classes from jars in a file and run the code from inside the running program
>>56361377
>>>/stackexchange/
>>56361430
Add the jars to your classpath and you can use any of the classes in them.