This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

question about compiling  RSS feed

 
rainier valde
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
 
Henry Wong
author
Sheriff
Posts: 23275
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!!!
 
Rob Spoor
Sheriff
Posts: 21044
85
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!