I googled it and found out, that the setErr method allows me to write the errors from the console into e.g. a text file.
What I was thinking of, is that it counts how many errors you got, e.g. somehow like that (using a command, but I don't know which one):
//the variable errorNumbers is just a placeholder for what a command from an import would do
int errorNumbers = 0;
//now here I need a method that checks, how many errors you got, from compiling a script with the java command
if(errorNumbers == 0) {
System.out.println("You got 0 errors"!);
} else if (errorNumbers <= 3) {
System.out.println("You got three errors or less!");
} else { System.out.println("You got more than three errors!"); }
I don't want to use the things, that the javac command is printing out in the console, I want it to check how many errors I got, from compiling that script.