When is this lexical error thrown? I have a program where I write test cases in a file. My java program parses the file, test cases are read and executed. In the parsing stage I encounter this error. What could be the reason?
lexical error encountered: "<" (60) after ""
You will get such an error message if you submit an HTML document to the W3C CSS Validator. The reason is that a construct like
<!DOCTYPE html> makes no sense in CSS and is not allowed even at the lexical level.
I have no idea of how this could relate to a Java program parsing files. My wild guess is that your program processes data and extracts or generates CSS style sheets from it, then passes the style sheets to CSS validation. In that case, something is wrong in the data or in the parsing – either the parser is not prepared to handling HTML (or XML) at all, or it it parses it wrongly.
I'm getting the same errors in my Java compile. Something in your build chain is performing static code analysis using the tool "cpd" (copy/paste detector). It throws lexical errors as it reads your code and fails to parse it. Unfortunately, I'm not sure what exact conditions cause it to fail. I hope that points you in the right direction!