File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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 > err.txt" will not work. in windowsNT/2000 it IS possible by using "javac 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:
(pascal source)
then at the command prompt, just type "stderr javac > 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:

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

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:
subject: fyi: solution to redirecting javac errors
It's not a secret anymore!