i tried to copy the result of the java compilation to the text file using
javac zz.java > compile.txt
It works if the program has no errors and it did not work if it have errors
i tried to copy the result of the java compilation to the text file using
javac zz.java > compile.txt
It works if the program has no errors and it did not work if it have errors
>and it did not work if it have errors.
Try to execute javac.exe as a subprocess using Runtime.exec method and get error output of subprocess using Process.getErrorStream() method.
String []cmd={"javac.exe","Sample.java"};
Process proc=Runtime.getRuntime().exec(cmd);
java.io.InputStream in=proc.getErrorStream();
you can also try,
javac zz.java 2> compile.txt
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.