*
The moose likes Beginning Java and the fly likes How do I route the compiler output? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How do I route the compiler output?" Watch "How do I route the compiler output?" New topic
Author

How do I route the compiler output?

Christopher Young
Ranch Hand

Joined: Nov 02, 2007
Posts: 63
Well first of all, I'm running Windows XP.

Ok, I'm using the java compiler from the command line and was wondering if there was a way i could save the error messages it generates to a file.

echo javac folder/file.java > errorList.txt only produces the line I typed in, although I know that file.java has a bunch of errors.

Is there a way I can actually get the data the compiler generates into a text file? I mean an IDE is somehow able to pull the messages it generates to put somewheree. I just think it'd be useful for (among other things) going back and fixing my code without having to switch back and forth between the console (Since I'm using TextPad)


Technology can never substitute for knowledge.
Christopher Young
Ranch Hand

Joined: Nov 02, 2007
Posts: 63
Nm.

Someone on another board told me to just write javac file.java 2> output.txt

and that works fine.

So problem solved.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19684
    
  20

Another hint that will allow you to redirect both standard output and error output to the same file:

The 2>&1 is for redirecting the error output (2) to the standard output (1; the & is for the address).


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I route the compiler output?