Export Java compilation errors into a file

November 9, 2009 at 10:50:23
Specs: Windows XP, ????
Hello!

I'm making some program (not in java - in PHP if it matters but its really irrelevant).

I need to compile some java files with javac.exe (and later run them)

To compile it I first copy all necessary files into a folder called "temp" and then compile it.

Example batch code:

cd temp
D:\Programs\Java\bin\javac.exe  Tester.java > compile_log.txt
java Tester > log.txt

When the java code is correct the program creates a file named "compile_log.txt" which is empty, and a file called "log.txt" with all the output from the java program.
(Which is perfect).

Now, when there are java compilation errors, I've expected compile_log.txt to contain all the errors, but its still empty.

How can I output the compilation errors into a file using batch?


See More: Export Java compilation errors into a file

Report •


#1
November 9, 2009 at 11:00:20
Have you tried
D:\Programs\Java\bin\javac.exe  Tester.java 2> compile_log.txt


Report •

#2
November 9, 2009 at 11:12:48
Wow! Thank you for the quick (and correct!) reply!


It works like a charm!


But I would really like to know what the "2" stands for.

The second "section"? second "echo statement"?


Thanks again,
Daniel


Report •

#3
November 9, 2009 at 11:27:05

Report •

Related Solutions


Ask Question