Diamond operator(<>) not working in java 1.7

前端 未结 3 1603
感动是毒
感动是毒 2020-12-21 15:39

I have the following error for compiling a jsp file:

\'<>\' operator is not allowed for source level below 1.7

I\'m using

3条回答
  •  执念已碎
    2020-12-21 16:28

    I know it's been over 2 years since this thread was last active but in case someone is looking for an answer and the above checks don't solve it: it's because the compiler that your tomcat is running is older than 1.7. One way to solve this is to add this to tomcat/conf/web.xml:

    
      jsp
      org.apache.jasper.servlet.JspServlet
      
          fork
          false
      
      
          xpoweredBy
          false
      
                                          
          compilerSourceVM
          1.7
      
      
          compilerTargetVM
          1.7
                                         
      3
    
    

    Source

提交回复
热议问题