• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fyi: solution to redirecting javac errors

 
Jon Dornback
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the info!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic