• Post Reply Bookmark Topic Watch Topic
  • New Topic

question about compiling  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there any way to transfer the result of the compiling to a text file? i compiled in a ms-dos environment and i have used ">"(javac hello.java > hello.txt) command to try transfer it in a text file but the text file does not have anything in it even if the compiled code has errors
 
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember that a program has both a standard out and standard err. To redirect *all* of the output, you need to send both the standard out and err to the file.

For Windows XP, this command will do just that...

javac hello.java > hello.txt 2>&1

Henry
 
rainier valde
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you!!!
 
Sheriff
Posts: 21136
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Henry Wong:
[QB]For Windows XP, this command will do just that...

javac hello.java > hello.txt 2>&1

That will work on most modern operating systems - I know for sure that Linux and Unix (and therefore also MacOS) support it. It's more likely Windows copied it from Unix than vice versa.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!