This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes output redirect?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "output redirect??" Watch "output redirect??" New topic
Author

output redirect??

Ravindra Harige
Ranch Hand

Joined: Jun 10, 2005
Posts: 33
cant we redirect the output of javac to a file?
i've tried 'redirect operator' ( > ) but it didnt worked.
is there any alternate...
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

The error output goes to the standard error stream; redirecting with ">" generally effects only the standard output. The precise syntax for redirecting the error stream (or even if it's possible at all) depends on your OS or shell.


[Jess in Action][AskingGoodQuestions]
Ravindra Harige
Ranch Hand

Joined: Jun 10, 2005
Posts: 33
hi ernest,
I work on windows XP Pro with SP2 .
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
Use the static method setErr(PrintStream err) from the System class.



You can do the same with the default output with setOut(PrintStream out).

Regards,
Edwin Dalorzo
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Originally posted by Edwin Dalorzo:
Use the static method setErr(PrintStream err) from the System class.


Yes, for your own applications -- but not terribly useful when running javac.exe , which is what we're talking about here.

Anyway, in XP you can use "2>", as in

javac Foo.java > output 2> errors
Ravindra Harige
Ranch Hand

Joined: Jun 10, 2005
Posts: 33
Hi Ernest,
Thank you. The solution that you provided was exactly what I was looking for and it works just the way I wanted.

regards,
ravindra harige
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: output redirect??
 
Similar Threads
redirecting content not going correct
mrutyunjay
How to show recent blogs in my webpage
sendRedirect curios behavior
Problem with redirect and a parameter