heroking146 发表于 2020-11-29 09:03:49

javax.servlet这个包找不到的原因是什么?

我搞了好几天,都标准配置jdk15版本,还通过CLASSPATHservlet-api.jar 去配置。同时还下载了javax.servlet.jar。添加到lib文件夹。tomcat运行良好,可就是javax.servlet 找不到,无法编译。maven3.6.3版本也安装了,编译其它没问题,可是编译javax.servlet 相关文件就无法找到。请问各位大咖,这个怎么解决?具体是什么原因javax.servlet. 找不到。这样就无法运行servlet相关文件了。还有其它好的办法吗?谢谢!!!!!

小甲鱼的铁粉 发表于 2020-11-29 09:28:26

jre1.8.0_271\lib\ext
你试一下加到这个路径可以吗?

heroking146 发表于 2020-11-29 13:00:20

小甲鱼的铁粉 发表于 2020-11-29 09:28
jre1.8.0_271\lib\ext
你试一下加到这个路径可以吗?

Scanning for projects...

---------------------< com.bjpowernode:ch01-maven >---------------------
Building ch01-maven 1.0-SNAPSHOT
--------------------------------[ jar ]---------------------------------
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time:0.164 s
Finished at: 2020-11-29T12:59:02+08:00
------------------------------------------------------------------------
Unknown lifecycle phase "MyServlet.java". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. ->

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException


以上是通过maven,编译servlet 方法无法通过的。

heroking146 发表于 2020-11-29 13:06:03

如何在jdk15上可以加入第三方javax包,且可以找到运行?

heroking146 发表于 2020-11-29 13:31:46

javax.servlet 一直是无法访问。

heroking146 发表于 2020-11-29 20:29:39

小甲鱼的铁粉 发表于 2020-11-29 09:28
jre1.8.0_271\lib\ext
你试一下加到这个路径可以吗?

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;


现在可能都用上边的类了。javax.servlet已经摒弃了。。。。。

小甲鱼的铁粉 发表于 2020-11-29 21:05:01

heroking146 发表于 2020-11-29 20:29
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta ...

害,这我也不懂了,我只会jdk编译器的基础
页: [1]
查看完整版本: javax.servlet这个包找不到的原因是什么?