天天看點

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path錯誤解決辦法

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path錯誤解決辦法

當代碼頭<%@報這個“The superclass “javax.servlet.http.HttpServlet” was not

found on the Java Build Path”錯誤時,可能是項目沒有添加tomcat庫導緻的,解決辦法如下:

  1. 找到報錯的項目,右擊選擇Build Path >> Configure Build Path…
    The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path錯誤解決辦法
  2. 依次選擇Java Build Path >> Libraries >> Add Library
    The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path錯誤解決辦法
  3. 選擇Server Runtime,然後Next
    The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path錯誤解決辦法
  4. 選擇你建立該項目時所使用的tomcat版本,這裡我是7.0,是以選第一個,然後Finish
    The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path錯誤解決辦法
  5. 應用更改與關閉即可
    The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path錯誤解決辦法

做完以上步驟後,錯誤就消失了,項目就能正常運作了

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path錯誤解決辦法

繼續閱讀