0

you can compile java codes in dos environment right? is it possible that errors in the codes found by the compiler be forwarded in a .txt fie?

5
Contributors
7
Replies
15
Views
9 Years
Discussion Span
Last Post by Swap_1
0

I believe (I am not 100% sure) that if you use a > and then follow it with a file name, you can catch the output of the Java compiler.

Try this:

javac MyApp.java > compileerrors.txt

That should save the feedback from the compiler into a file name compileerrors.txt in the same directory as your Java class MyApp.java.

Give it a try, I'm not 100% that it will work for you.

0

Make sure your Java classpath is set properly in windows environment variables.

0

I'm not sure, but I think the reason why the txt-file is empty, is that you have redirected standard-output to the textfile, and the compiler prints all error-messages in error-output.

if you redirect with 2> instead of > you get the error stream.

example: javac *.java > output.txt 2> error.txt I think that should do the trick.

0

i dont know who you are but i want to thank you very much vidaj thanx again i was try to create java compiler emulator using java i was stuck but now i can proceed because of your " javac *.java > output.txt 2> error.txt " suggestion :)

Votes + Comments
zombie master
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.