Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Compilation at MSDOS prompt

 
Mark Mokris
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many times I work with Java outside of an integrated environment, and I compile my programs at the MSDOS command prompt with javac.
Frequently, when I write a new program, the initial compiles generate so many syntax errors that the errors at the top scroll off the top of the screen, and I lose them. I can set my MSDOS window to 50 lines, but this isn't always sufficient.
Has anybody figured out a solution to this?
Thanks,
Mark
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can pipe the output to a file.
e.g. 'javac Test.java > compileResult.log'
If you are using Windows NT/2000/XP then you can specify a very large screen buffer.
/Rene
 
DanCranmer
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Errors need to be redirected using the following:
javac Test.java 2> compileResult.log
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depending on your OS you may also be able to change the buffer size.
 
Mark Mokris
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I coded a Java program which contains syntax errors. At the MSDOS prompt I typed:
javac HelloWorld.java > error.log
It STILL displays my syntax errors on the screen. It creates an error.log file but there is nothing in it. Anybody have any ideas?
Thanks,
Mark Mokris
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from an earlier post:
Errors need to be redirected using the following:
javac Test.java 2> compileResult.log

/Rene
[ July 16, 2002: Message edited by: Rene Larsen ]
 
Mark Mokris
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rene and others...
I appreciate what you are saying. Is there something I am not seeing? I type:
javac HelloWorld.java > compileResult.log
The syntax errors still display on my screen. It creates a file called compileResult.log, but there is nothing in it. This is MSDOS. Does the redirect technique only work on UNIX? Does it work for you on MSDOS?
Thanks!
Mark
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To pipe an error you need to have '2' before the '>'
/Rene
 
Marilyn de Queiroz
Sheriff
Posts: 9066
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using Win9x, piping errors from javac won't work (unless you are using the jdk 1.1.8 which I doubt). You used to be able to change the setting, but Sun removed that functionality with version 1.3. The only way you'll be able to see all the errors that I know of with Win9x is to use a text editor like TextPad and reroute the output within the text editor.

I suggest clearing the errors you can see and gradually the list will be small enough that you can see all of them.
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can set your DOS windows to display scroll bars when there are more than 50 lines. Click on properties in your DOS window, under the layout tab, set the height of the screen buffr size to something large like 300.
 
Mark Mokris
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rene, Dan, Paul, Marilyn and Bosun!
I appreciate all your advice, but I am running Win/98, and as Marilyn says, I cannot pipe the errors to a file. Nor does it allow me to set the MSDOS screen such that I receive scroll bars. I guess I am just out-of-luck, and will have to clear some of the later errors first.
Thanks!
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic