import java.io.*;
public class ProcessDemo
{
public ProcessDemo()
{
}
public static void main(String args[])
throws Exception
{
String s = "System.out.println(\"zzzzzyyyy\")";
eval(s);
}
private static void eval(String s)
throws Exception
{
StringBuilder stringbuilder = new StringBuilder(80);
stringbuilder.append("public class Hello{");
stringbuilder.append("public static void main(String[] args){");
stringbuilder.append(s).append(";");
stringbuilder.append("}");
stringbuilder.append("}");
FileOutputStream fileoutputstream = new FileOutputStream("Hello.java");
fileoutputstream.write(stringbuilder.toString().getBytes());
fileoutputstream.close();
Process process = Runtime.getRuntime().exec("javac Hello.java");
InputStream inputstream = process.getErrorStream();
byte abyte0[] = new byte[1024];
for (int i = -1; (i = inputstream.read(abyte0)) != -1;)
{
String s1 = new String(abyte0, 0, i);
System.out.println(s1);
}
inputstream.close();
Process process1 = Runtime.getRuntime().exec("java Hello");
InputStream inputstream1 = process1.getErrorStream();
int j;
while ((j = inputstream1.read(abyte0)) != -1)
{
String s2 = new String(abyte0, 0, j);
System.out.println(s2);
}
inputstream1.close();
}
}