Results 1 to 12 of 12
  1. #1
    JimmyD is offline Member
    Join Date
    Oct 2011
    Location
    New Jersey
    Posts
    44
    Rep Power
    0

    Default Too many compile errors in Windows command prompt, Can't see the first one

    Hi,

    I can't believe I have to post a thread to ask this, but I can't google the answer I need...

    My java program gives too many error messages at compilation.

    I am pretty sure they are caused by a small syntax error and are all chain-errored, as they are the result of an edit to a working .java file I am developing.. All I need is to see what's error no. 1.

    However there are > 100 errors, so windows cmd windows cannot display them. I am not really using a IDE.. (I am installing eclipse right now.. but while I am doing that my curiosity drove me to post here..)

    Is there a solution so that I can split the screen so that the screen pauses when the compiling error takes up 1 command window size? or can I output the compile error message the a file?

  2. #2
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Too many compile errors in Windows command prompt, Can't see the first one

    Easy enough on Linux. Perhaps the Windows command shell is similar.

    You could pipe the output of javac to the 'more' program, which pauses between pages of output: javac YourClass.java | more

    (Linux also has an improved version of 'more' called 'less', but I doubt Windows has that.)

    Or you could redirect javac's output to a text file: javac YourClass.java > errors.txt
    Get in the habit of using standard Java naming conventions!

  3. #3
    JimmyD is offline Member
    Join Date
    Oct 2011
    Location
    New Jersey
    Posts
    44
    Rep Power
    0

    Default Re: Too many compile errors in Windows command prompt, Can't see the first one

    hi kjkrum!

    Thanks for the reply. I've tried those approaches, but they don't work. I came to the conclusion that in windows cmd, the error messages is in a different stream from that in linux?

    What I mean is that I can't pipe the compile errors or redirect them to be put in a file.

    By the way, windows has more but no less=)

  4. #4
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Too many compile errors in Windows command prompt, Can't see the first one

    Hmm. The last Windows I really used was XP, and it had redirection. Microsoft Windows XP - Using command redirection operators What version are you using? Hopefully someone with more up-to-date Windows knowledge can help you.

    Edit: maybe you need to specify 2 for the error channel: javac YourClass.java 2> errors.txt
    Last edited by kjkrum; 04-16-2012 at 02:00 AM.
    Get in the habit of using standard Java naming conventions!

  5. #5
    JimmyD is offline Member
    Join Date
    Oct 2011
    Location
    New Jersey
    Posts
    44
    Rep Power
    0

    Default Re: Too many compile errors in Windows command prompt, Can't see the first one

    That unfortunately doesn't work either >..<

    javac: invalid flag: 2
    Usage: javac <options> <source files>
    use -help for a list of possible options

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,235
    Rep Power
    19

    Default Re: Too many compile errors in Windows command prompt, Can't see the first one

    There are two varieties of the Command prompt: command.com and cmd.exe. Have you tried both?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  7. #7
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: Too many compile errors in Windows command prompt, Can't see the first one

    You can increase the screen buffer in the properties menu of the command terminal.
    Just give it a 1000 line buffer (or more).
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  8. #8
    JimmyD is offline Member
    Join Date
    Oct 2011
    Location
    New Jersey
    Posts
    44
    Rep Power
    0

    Default Re: Too many compile errors in Windows command prompt, Can't see the first one

    Quote Originally Posted by DarrylBurke View Post
    There are two varieties of the Command prompt: command.com and cmd.exe. Have you tried both?

    db
    I tried both, before I was doing right click on folder and chose "open command window here", now I typed "command" in start menu or "cmd" in start menu and started both command and cmd, unless I was not starting them right.. but it doesn work..

  9. #9
    JimmyD is offline Member
    Join Date
    Oct 2011
    Location
    New Jersey
    Posts
    44
    Rep Power
    0

    Default Re: Too many compile errors in Windows command prompt, Can't see the first one

    Quote Originally Posted by Tolls View Post
    You can increase the screen buffer in the properties menu of the command terminal.
    Just give it a 1000 line buffer (or more).
    Tolls, I can't find the property to set the buffer size.. it only lets me to set history buffer size, changing which does not help to increase the execution output buffer. I am googling it though.. I am surprised javac does not have a good option here.. >..<

  10. #10
    JimmyD is offline Member
    Join Date
    Oct 2011
    Location
    New Jersey
    Posts
    44
    Rep Power
    0

    Default Re: Too many compile errors in Windows command prompt, Can't see the first one

    aha~ I found it after bit of googling.. "screen buffer size".. lol~ problem solved! Thanks Tolls!

  11. #11
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,235
    Rep Power
    19

    Default Re: Too many compile errors in Windows command prompt, Can't see the first one

    I just tried what kjkrum suggested at #4 (after first commenting a variable declaration in a source file) and the error output was written to a file. Windows 7, Java 6.
    Java Code:
    javac FileName.java 2> errors.txt
    If you're getting
    javac: invalid flag: 2
    it looks like you put a dash (-) ahead of the 2.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  12. #12
    JimmyD is offline Member
    Join Date
    Oct 2011
    Location
    New Jersey
    Posts
    44
    Rep Power
    0

    Default Re: Too many compile errors in Windows command prompt, Can't see the first one

    Quote Originally Posted by DarrylBurke View Post
    I just tried what kjkrum suggested at #4 (after first commenting a variable declaration in a source file) and the error output was written to a file. Windows 7, Java 6.
    Java Code:
    javac FileName.java 2> errors.txt
    If you're gettingit looks like you put a dash (-) ahead of the 2.

    db
    I got it this time.. 2> muz be connected.. forgot about that! Thanks everyone for helping me out!

Similar Threads

  1. Replies: 2
    Last Post: 11-08-2011, 12:21 AM
  2. Letting my program command the command prompt
    By Smokey. in forum Threads and Synchronization
    Replies: 4
    Last Post: 03-29-2011, 11:34 PM
  3. Replies: 4
    Last Post: 01-04-2011, 12:36 AM
  4. how to run windows command prompt in java parogram ?
    By indikasampath2000 in forum AWT / Swing
    Replies: 4
    Last Post: 12-16-2008, 06:51 AM
  5. Replies: 2
    Last Post: 08-06-2007, 09:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •