I got this error too, and thought I would post a slightly more complete answer as there have been a few visits to this question since it was posted.
There is a near duplicate of this question here: javac error: Class names are only accepted if annotation processing is explicitly requested. However, this question came up first for me on google, as my error message matched Joao's more closely (it relates to the junit framework).
Lawrence's answer above assumes that the poster was wanting to compile, but this is not the case as Joao states in his original question (and later in his comment). He had already compiled and was wanting to run the programme, but made a typo with javac
in place of java
. As javac
expects a filename ending '.java' as standard input, it spits out the error: Class names...annotation processing...
error message in response.
So if you are getting this message, when trying to run your test code, then you have probably mistyped the command.
P.S. I would have put this in a comment but do not have the reputation.