aspose file tools*
The moose likes Beginning Java and the fly likes fyi: solution to redirecting javac errors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "fyi: solution to redirecting javac errors" Watch "fyi: solution to redirecting javac errors" New topic
Author

fyi: solution to redirecting javac errors

Jon Dornback
Ranch Hand

Joined: Apr 24, 2002
Posts: 137
i've seen multiple posts by those with the misfortune of using win9x as their development enviroment who are trying to redirect the output from javac to a file. here's the summary and solution:
javac (java1.3) by default sends output to stderr. in dos this is not redirectable, so "javac foo.java > err.txt" will not work. in windowsNT/2000 it IS possible by using "javac foo.java 2> err.txt" you have to have "2>", not ">" or it will not work.
in java1.4, there is an option to send output to stdout. use this:
javac -J-Djavac.pipe.output=true foo.class
this is buggy in 1.3 and will not work.
so what is left for those still stuck in win9x? try this great util developed by some wonderful person on the net:
(instructions) http://www.teaser.fr/~amajorel/stderr/
(download) http://www.teaser.fr/~amajorel/stderr/stderr.exe
(pascal source) http://www.teaser.fr/~amajorel/stderr/stderr.pas
then at the command prompt, just type "stderr javac foo.java > err.txt". i tried it and it works great - i can now see all 37 errors! hope this helps someone.
more options at the sun site:
http://access1.sun.com/technotes/00642.html


use the [CODE] tags - it makes it much easier for people to help you.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Thanks for the info!


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: fyi: solution to redirecting javac errors