• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is javac CaptureCompileOutput.java >> Output.txt possible ?  RSS feed

 
James Hetfield
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I wish to capture the compile time and runtime outputs and display it in my Swing GUI...
..am able to redirect runtime output by issuing the command
--> java <FileName> >> runtime.txt
then I read contents from file and display it in my GUI...
Similarly is it not possible for me to redirect compile time output...ie.,
whatever is the after effects of
---> javac <FileName>.java >> Output.txt
Ideally it should contain all compile errors without displaying anything in the command prompt and in case of no compile error then it need not populate the text file...!!
..but the compile time capture part didn't work for me...
It'd be fab. if any one o you out there could educate me with compile time output capturing.
Thanx,
Best Regards,
James.
 
Jeremy Thornton
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like you want to redirect the error stream to a file.
Depending on the OS you're using it'll look something like:
javac MyFile.java 2> output.log
[ October 29, 2003: Message edited by: Jeremy Thornton ]
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You didn't mention runtime.exec() but I'm guessing that's what you're using. Look at the process you get back from that call. You can hook readers up to the stdout and error out of the command you run and pump the results back into your GUI in real time. That skips the whole write to disk, try to figure out when it's done, read from disk, erase the files when you're done part. Lemme know if that's enough to run with, or if examples would help.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!