I have a JSP file that consists of two <%@ include ...
lines and a scriptlet, nothing else. The file ends with the scriplet closing %>
, and no new line. The file compiles and is served by Tomcat as expected.
If I add a new line to the end of the file (more precisely, when Emacs does it automatically after I edit the file), the page produces a 500 error "Unable to compile class" with the specific complaint that the final line (now effectively %>\n
) is "unreachable code".
I've gone back-and-forth in multiple editors, and I'm certain that the only difference between functioning and non-functioning files is the presence of the new line at the end of the file. I've searched, and I can't find any discussion of this kind of problem. Why does the closing newline break Java/Tomcat in this instance?