Servlet异常

来源:互联网 发布:儿童编程入门 编辑:程序博客网 时间:2024/05/16 19:07

The type javax.servlet.ServletContext cannot be resolved.  It is indirectly referenced from required

The type javax.servlet.jsp.JspException cannot be resolved.  It is indirectly referenced from required .class   files

有时候用eclipse导入一个外来的工程时会出现以上错误,这主要是因为你的电脑上安装了多个版本的jdk,
解决的办法是:
1.右击工程目录下的jdk 选择 build path---->config build path (或者在eclipse菜单栏点击project----->propertys )    
2.在里面再选择Java Build Path -----> Libraries---->Add Libraries----->JRE System Library
 
 

Eclipse中遇到The type XXX cannot be resolved. It is indirectly referenced from required .class files错误.....,查找的解决办法如下:

:
It is indirectly referenced from required .class file

原因:你正要使用的类调用了另一个类,而这个类又调用了其他类,这种关系可能会有好多层。而在这个调用的过程中,某个类所在的包的缺失就会造成以上那个错误。

解决方法:导入缺失的包

:
The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project 
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files

出现以上讯息的原因是因为你装了多个版本的jrejdk的关系。本来Eclipse在建立专案时,会自动参照你的jre路径,但多个版本就没办法了。
你只能手动建立
1. 进入window\preferences\java\Installed JREs
1)Add
2)输入JRE Name, JDK1.5.0.03
3)JRE home directory, 选择安装的路径
4)OK
2. 进入Project\properties\Java Bulid Path
1)Add library
2)JRE System Library后按Next
3)workplace default JRE后按finish...

 

原创粉丝点击