Results 1 to 1 of 1
  1. #1
    DavidH is offline Member
    Join Date
    Aug 2009
    Rep Power

    Default Java assert messages lost

    Hi folks,

    My assert messages have mysteriously vanished from the console. The acceptance test still stops executing when an assert fails, but I see no message. I am using Eclipse 3.4.2.
    1. I have set (in Eclipse > Preferences... > Java > Compiler)(*):
      • Compiler compliance level to 1.5
      • Use default compliance settings is checked
    2. I have set (in Run > Run Configurations... > Java Application > [my application] > Arguments > VM arguments):
    3. I have code in a class static block to confirm that assert is enabled:
      Java Code:
          static {
              boolean assertsEnabled = false;
              assert assertsEnabled = true; // Intentional side effect!!!
              if (!assertsEnabled)
                  throw new RuntimeException("Asserts must be enabled for User Tests!!!");
      ... and yes, the RuntimeException is thrown if I take the -enableassertions flag out of the VM arguments.
    4. As I mentioned above, the execution is interrupted when an assertion fails - I simply don't see the message on the console.
    5. This was working. I put aside the project for a week, then came back to it, only to find this broken.

    I don't know if I accidentally changed some setting, or if I've blanked on where I should be looking for the messages or what happened. Any suggestions appreciated.

    Thank you,

    (*) Yes, I'm using eclipse on Mac OS X. This should be the same Preferences panel as other users find under Window > Preferences...
    Last edited by DavidH; 08-09-2009 at 07:01 PM.

Similar Threads

  1. Lost and confused - Java/j and mxj
    By etherkye in forum JDBC
    Replies: 1
    Last Post: 07-02-2009, 06:35 PM
  2. Has Java lost its way?
    By alexj44 in forum Advanced Java
    Replies: 4
    Last Post: 09-23-2008, 01:26 PM
  3. I am so lost in my java class
    By taliGLM in forum New To Java
    Replies: 1
    Last Post: 04-30-2008, 10:02 PM
  4. Assert with an informative message
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-16-2008, 11:04 PM
  5. Assert - not showing any msg on console
    By ravian in forum New To Java
    Replies: 0
    Last Post: 11-16-2007, 04:20 PM

Tags for this Thread

Posting Permissions

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