Java遇到的问题
问题1:
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build PathJSP页面顶端出现红色的报错信息:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path。原来Javaweb工程类中没有添加Tomcat运行时相关类导致。
下面是具体的解决方法:
1、右击web工程-》属性或Build Path-》Java Build Path->Libraries-> Add Libray...->Server Runtime -》Tomcat Server
2、切换到Java Build Path界面中的Orader and Export,选择Tomcat。注意:
按以上方法操作时,若打开Server Runtime后一片空白,需要设置Apache服务器。设置方法为:window->Preferences->Server->Runtime Environment -> add --> 选择Apache的版本后点Next,再填入你apache服务器软件的安装(解压后)地址。转自https://blog.csdn.net/qq_37844454/article/details/83387989的答案。
问题二:
Multiple annotations found at this line: String cannot be resolved to a type No exception of type ServletException can be thrown; an exception type must be a subclass of Throwable The method getContextPath() from the type HttpServletRequest refers to the missing type String java.io.IOException cannot be resolved to a type解决方法:build path 中重新选择server runtime ,jre
问题3:
Description Resource Path Location Type Target runtime Apache Tomcat v7.0 is not defined. JavaEE_2_SpringMVC_1.1 Unknown Faceted Project Problem解决方法:
Eclipse导入工程后工程上显示一个小红叉,但工程里没有文件错误,也没有语法错误,在problems中显示错误是:Target runtime Apache Tomcat 6.0 is not defined.
【项目】->【右键】->【Properties】.
Target runtimes -----> 重新选择tomcat
转自https://blog.csdn.net/u012838836/article/details/53290540的blog。
数组访问越界
Java.lang.ArrayIndexOutofBoundException

浙公网安备 33010602011771号