Hi Koldark,
Do you mean runtime errors or compiler errors? Runtime errors are easy to write to the file: Just add try - catch to your source and write the error inside the catch-block
E.g.
try
{
do something...
}
catch(Exception e)
{
somewriter.println(e.toString());
}
But if you mean the compiler error messages, to be honest, I don't know how to redirect those

But here is a some kind of hack

(hehe)
That program should work and it compiles the
source you have given & writes the compiler error messages to file. (But seriously, I have never thought how to redirect that compiler input in windows console... if somebody knows, please tell...)
_____________________________________________
import java.io.*;
public class RTJavac
{
public static void main(String[] argv)
{
if(argv.length == 0)
{
System.out.println("Usage: java RTJavac <java source name>"

;
return;
}
try
{
String compilerInput = null;
// This is the file where compiler output will be written
FileWriter fw = new FileWriter("complierlog.txt", false); // No append
PrintWriter pw = new PrintWriter(fw);
// execute javac to compile the source given as a parameter
Process p = Runtime.getRuntime().exec("javac " + argv[0]);
// Get the process' Error stream
InputStream is = p.getErrorStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
// Print compiler errors to the screen and write to file
System.out.println("Compiler errors:"

;
while((compilerInput = br.readLine()) != null)
{
System.out.println(compilerInput);
pw.println(compilerInput);
pw.flush();
}
}
catch(IOException ioe)
{
System.out.println("Following error has occured: " + ioe.toString());
}
}
}