I'm trying to give the user the option to write one line of code in my program. Their input is saved as a String and I need that string to transfer into a line of code in the eclipse IDE. For example:
String a = "System.out.println("String code test.");"
Now I need this String to compile into the program and print out the text. Is their a way to do this considering when the user inputs the line of code the program has already compiled and therefore cannot insert a new line of code?
I know this question is sort of confusing but if anyone can understand this post or had a similar problem, I would enjoy hearing feedback.
EDIT: I have realized that I might be able to use a BufferedWriter to write to a .java file and then just call that class after it has been writen. Can you write to .java files using BufferedWriter?