I am compiling a java program from a Dos prompt under Windows98. (Ex: javac TestProgram.java) I have numerous error messages. Errors at the top of the program scroll off the Dos prompt screen. I can only view the errors that are further down in the program. Is there a trick for capturing the messages to a file? I have tried "piping" the errors to a file without it working. (Ex: javac TestProgram.java > holdErrors.txt) I know if I went to an IDE environment, like JBuilder 4, it would hold my error messages in one of its windows. But, I am learning java and preparing for the Certification exam. On advise from others at the "ranch", they have recommended against using it. Thanks.
The standard I/O channels were assigned numbers : 0 - standard input 1 - standard output 2 - standard error
These were primarily used in Unix system programming, but in this one way it crept into user commands... I guess the same syntax was used in DOS because they couldn't think of another way to signify the error stream...
So... unfortunately... we can't bash Microsoft for it...
Joined: Sep 29, 2000
And does UNIX use the "2>" command for piping?
Joined: Jun 28, 2001
I tried the suggested: javac TestProgram.java 2> holdErrors.txt and I got the javac.exe utility complaining that it did not like the command line arguments. I got the same screen as if I had typed javac by itself. (The option/paramater screen for the javac.exe utility)
[This message has been edited by Scott Matthews (edited July 10, 2001).] [This message has been edited by Scott Matthews (edited July 10, 2001).]
Cindy- Yes! Well... sh ( and most of it's derivatives ) use this... but some other shells ( notably csh ) do different things... ( csh uses >& to redirect stdout and stderr to a file... strangely enough, it doesn't provide a way to redirect only stderr... )
Scott- Hmmm... Just to make sure, I tried this just now at work on my Windows NT machine, and on my Solaris box... this worked on both of them...
I looked up javac in the Sun documentation and came up with this... The old version of javac supported a command line argument to redirect output from stderr to stdout... for some reason the new version of javac does not support this... I even found a bug report on Sun's site that mentions needing this option because it is "useful under win32 due to shell inadequacies"... Hmmm... wonder if this is your problem?
Anyway... this may work...
I am not sure what the ramifications of using the old compiler would be... but tell us if this works...
By the way... when I got home, I tested this out on my Win98 computer... sure enough! Windows 98 doesn't support the 2> redirect! I wonder why? WinNT supports it, and I am pretty sure that older versions of DOS ( and perhaps Win95? I don't remember... ) used it too...
So, I guess we can blame M$ for this one at least, eh Cindy?
I am not sure if the 'oldjavac' fix I gave above works on Win98... I only had java 1.2 installed on my Win98 computer... it only came with the new version of javac that doesn't have the -Xstdout parameter... I think it shipped with Java 1.3...
Oh, well... If that doesn't work then I guess you could follow Fred's suggestion above and change the properties of the DOS window so it will let you scroll back...
Microsoft OS's based on DOS haven't had built in capability to redirect stderr for as long as I can remember. It's been a real pain in the side for me. If you're *ambitious*, and you've got a Windows C compiler such as MSVC++, and you can decipher Microsoft's developer documentation, you might be able to build yourself a program that will redirect stderr. Here's a starting point: http://support.microsoft.com/support/kb/articles/Q190/3/51.ASP Good luck.
There are two types of DOS prompts under Windows NT, command and cmd. Under Windows 9x there is only one, command.com. command does not give you the ability to change the buffer size if she is using Win98 this is not an option for her. MS added alot of Unix-ish funtionality to NT's DOS prompt(cmd) but hasn't to Windows 9x(command). I.E. under Windows NT you could type cd prog* and this should take you to c:\program files under 9x this will not work. My guess is that MS wants to push _ANY_ development type work to NT and therefore hinders 9x functionality. Or they don;t believe anyone using 9x would need this type of command line power. Also, I don't believe>2 will work under 9x also. Hope this helps, Bill Norton
Originally posted by karl koch: hi, just use a tool as UltraEdit to do this. you can capture outputs to the editor window. karl
Hi Karl, How can we capture outputs using Ultraedit? Thanks.
Joined: Mar 29, 2001
I believe we have missed the easiest solution. Just write code that has no bugs. Bill
Joined: Sep 29, 2000
Of COURSE! And you are here to lead the way . By all means share with us the tricks and techniques to do that. WE await your quidance "oh wise one".
Joined: Mar 29, 2001
Oh no, I am a consultant, I just tell you how to fix your problems I don't actually do it for you!! I did write a program that printed "Hello World!" the other day with no bugs. Proof of concept. Bill Norton