views:

35

answers:

5

Noob question, apologies. I'm compiling Java in Windows Vista's command-line and have so many syntax errors that some are being pushed off the top (a lot of 'class, interface or enum expected' errors which leads me to believe it's an obvious syntax mistake early on in the code that I can't spot). Does anyone know how I could get it to display those first errors?

Thanks in advance for the help.

+1  A: 

Try increasing the buffer size for your command-prompt. Read more here:
http://www.cs.princeton.edu/introcs/15inout/windows-cmd.html

Ben Hocking
A: 

Use an IDE so you 1) don't have to scroll for pages to find errors 2) can jump straight to the line with the error.

matt b
Along these lines, I'd recommend Eclipse. It's what UVA uses for introductory classes. Here's the 32-bit download for Windows: http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.5.2-201002111343/eclipse-SDK-3.5.2-win32.zipHere's the 64-bit version: http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.5.2-201002111343/eclipse-SDK-3.5.2-win32-x86_64.zip
Ben Hocking
This is not what was asked.
asveikau
Might not be what he asked but he might not realize that there are options that will make his efforts *far* easier
matt b
+3  A: 

You have several options:

  • route stdout and stderr to a file:

    javac [whatever] > file.out 2>&1

  • use an IDE

  • increase the 'height' of your command console's buffer in "Properties/Layout/Screen Buffer Size" - I routinely set this setting to 6000 so I can scroll back a long ways...

Michael Burr
A: 

Redirect your ouput for the command's errors to a text file and open it on notepad

ex: suppoing Test.java is your program

> javac Test.java 2>errs.txt
> notepad errs.txt
ring bearer
+1  A: 

you can

1 - as Matt says Use an IDE, will make your life much easier. there are plenty of good ones.

2 - as Ben said you can increase the buffer but even if you do so you still run the chance of loosing some messages.

3 - you can pipe the output through more ex :

javac SomeClass.java | more

However this will make your compiling much longer as it will wait for you to scroll pages

4 - redirect the messages to a file ex :

javac SomeClass.java > compileLog.txt 2>&1

More on redirection for CMD here. This way you can view the messages without worrying that you missed any or without being constrained to the command line window. Search through them etc.

Newtopian