# How do I get the assert statement to work?
In Eclipse 3.1, go to Window -> Preferences -> Java -> Compiler and set the Compiler Compliance Level to 1.4 or 5.0. Also check Use Default compliance settings. This tells the compiler to recognize and allow assert statements, but does not enable them.
In Eclipse 3.0 (Java 1.4), the settings are a little fussier. Go to Window -> Preferences -> Java -> Compiler -> Compliance and Classfiles and set:
Compiler Compliance Level: to 1.4
Use default compliance settings to unchecked
Generated .class files compatibility: to 1.4
Source compatibility: to 1.4
Disallow identifiers called 'assert': to Error
Compiler Compliance Level to 1.4
To enable (make active) assert statements, you must set a flag to the compiler. Go to Run -> Run... -> Arguments, and in the box labeled VM arguments:, enter either -enableassertions or just -ea. Accept the changes and close the dialog.
To get Javadoc to recognize the assert statement, see How do I run Javadoc?
http://www.cis.upenn.edu/~matuszek/cit594-2005/Pages/eclipse-faq.html#assert