Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Creating a List file during compilation

  Asked By: Clifford    Date: Sep 13    Category: Java    Views: 1670

Is it possible to create a list file while compiling a Java program
using the javac command ? If so, how ?

The idea, of course, is that the Compiler may send the Messages to
the List file rather than to the Screen, so that the Messages may be
studied and the Program corrected.

(As you know, when sent to the Screen, the earlier messages might



4 Answers Found

Answer #1    Answered By: Sebastien Anderson     Answered On: Sep 13

Ah, how do you compile programs? By input command  in console? OK, two

1. if you use an IDE, or editors such as uedit32, editplus, they will
record all the messages.

2. If you input "javac classes.java" in console, there is a powerful
tool called pipe

javac classes.java >compile-message.txt 2>error-message.txt

Error messages  will be stored in the error-message.txt, and others will
be stored in compile-message.txt.
And if you want to store these two in same file, do this one:
javac classes.java >all-messages.txt 2>&1

This works fine in both unix and win2k.

Answer #2    Answered By: Hu Chalthoum     Answered On: Sep 13

First of all, Im sorry tht i hv thought u r asking how to
change the Output/Error streams to a JList while Runtime. But
actually u hv asked how to get the output of "javac" command. I hope
from next time i will understand the question 100% before replying...

To Yin Ming, I hv tried ur syntax to get the msgs of "javac"
command, but the problem is both the outputs of compiler/error msgs
are redirected to the second file  only, im not getting anything in
the first file.

For ex. if im using deprecated method & im using

javac -deprecation Classes.java >Compile.txt 2>Error.txt

still the output goes only to "Error.txt" only, im not getting the
compiler output to the first file "Compile.txt".

Answer #3    Answered By: Danny Perkins     Answered On: Sep 13

Oh, it seems javac  outputs all the messages  to stderr, or saying, all
the messages are just error messages.

Answer #4    Answered By: Riley-jack Johnson     Answered On: Sep 13

I'm not getting anything in the first file  (i.e., no
error msgs as well as no compiler  msgs)

javac -verbose TimeCalc.java >Compile.txt

u can see the above sample, im trying to get
compiler's verbose msgs in Compile.txt & error msgs in
ErrorMsg.txt, but it's not happening (all the output
is going to ErrorMsg.txt only)

Didn't find what you were looking for? Find more on Creating a List file during compilation Or get search suggestion and latest updates.