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?

Recommended Answers

All 7 Replies

Member Avatar for Dukane

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.

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

it creates a txt file but there's nothing in it

Member Avatar for Dukane

Perhaps the class is compiling without error?

even with an error there is nothing in the txt file

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.

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 :)

commented: zombie master -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.