Is there a java equivalent of the python eval function?
This would be a function which takes an arbitrary string and attempts to execute it in the current context.>
It may be that you wish to execute a DOS or unix command in the workflow of Java program execution...
String command = "cmd /c dir /s";
String homeDir = "C:\\WINDOWS";
Process process = Runtime.getRuntime().exec(command + " " + homeDir);
And may be you wish to process the output...
final InputStream in = process.getInputStream();
int ch;
while((ch = in.read()) != -1) {
System.out.print((char)ch);
}
Close code with try, catch