如何更改docker上tomcat的jdk版本

发布于 2025-01-14 04:37:57 字数 845 浏览 0 评论 0原文

我想在docker上的tomcat容器中使用jdk-17 因为tomcat上现在的openjdk-11.0.14.1+1不支持我的代码 (错误:无法解析类型 javax.servlet.http.HttpServletRequest。) 这让我很难过

代码正在使用tomcat 10和jdk17.0.2的eclipse上运行

,所以我尝试在tomcat上下载jdk17 并更改 /usr/local/tomcat/bin/catalina.sh 上的路径

Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/lib/jvm/jdk-17
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.

,但 java --version

openjdk 11.0.14 2022-01-18
OpenJDK Runtime Environment (build 11.0.14+9-post-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 11.0.14+9-post-Debian-1deb11u1, mixed mode, sharing)

仍然相同

,您可以帮助我让我知道如何修复它吗?

I want to use jdk-17 in tomcat container on docker
cuz openjdk-11.0.14.1+1 which is now on the tomcat doesn't support my code
(Error : The type javax.servlet.http.HttpServletRequest cannot be resolved.)
which make me sad

The code is working on eclipse with tomcat 10 and jdk17.0.2

so I tried to download jdk17 on tomcat
and change the path on /usr/local/tomcat/bin/catalina.sh

Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/lib/jvm/jdk-17
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.

but the java --version

openjdk 11.0.14 2022-01-18
OpenJDK Runtime Environment (build 11.0.14+9-post-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 11.0.14+9-post-Debian-1deb11u1, mixed mode, sharing)

is still same

could you help me to let me know how to fix it..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文