In order for the javac bytecode compiler to accept code containing assertions, you must use the -source 1.4 command-line option as in this example:
javac -source 1.4 MyClass.java