Javac Error Saver


Here's a sweet little Java Application that you can use to compile your Java programs. It prints out your errors in a seperate file ( called "output1.txt" here ). And you can actually see the errors. They don't scroll by so fast you can't see them on that horrible DOS screen. Copy and Paste it to a Notepad and save as "JC.java" (with quotation marks. Compile it and put it in your JDK bin where your javac ( compiler ) is.

To use the program, use your version of the following DOS command:

java JC YourProgram.java > output1.txt


Written and compiled by Réal Gagnon ©1998-2000 mailto:real@rgagnon.com
Used By Permission

import java.io.*;
public class JC {
  public static void main( String args[] )
    throws IOException, InterruptedException {
    String fn = "JC.java";
    if( args.length > 0 ) fn = args[0];
    System.out.println( "BEGIN (" + fn + ")" );
    Process p =     Runtime.getRuntime().exec( "javac -verbose " + fn );
    String buf;
    BufferedReader se = new BufferedReader
    ( new InputStreamReader( p.getErrorStream() ) );
    while( (buf = se.readLine()) != null )
    System.out.println( " : " + buf );
    System.out.println( "END (rc:" + p.waitFor() + ")" );
  }
}

 

 

 

 

 

Back to Main Page