I compiled a Java program as
javac t1.java > a
in order to redirect the error messages to file a. But a doesn’t have the error contents (they still appear in the terminal). The command is executed from Linux command prompt.
The contents of t1.java is as:
class t1 {
public static void main(String[] args) {
System.out.printn("Hello World!"); // Display the string.
}
}
So now there is an error, i.e. println is written as printn.
How can I capture this error message in file a?
Try redirecting the
stderr: